suggestion needed

Hello,

Is there a way to have a rewrite done for two files for the same path?
like this:

RewriteRule ^area/(.*) indexMap1.php?area=$1 [L,QSA]
RewriteRule ^area/(.*) indexMapContents1.php?area=$1 [L,QSA]

Your probably thinking "why would you wanna do that?"

The reason why I want to do this is because indexMap1.php is accessed
with a subdomain as following: http://something.mywebsite.com ....
something goes into some var already before these 2 rewrite rules this
way:

RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mywebsite\.com
RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
RewriteRule ^$ indexMap1.php?location=%2 [L,QSA]

now, inside my indexMap1.php file I'm using indexMapContents1.php as a
javascript like this:

echo "<script type=\"text/javascript\" src=\"/indexMapContents1.php
\"></script>";

and then inside that file I tell it that its actually a JS file and
not a php...

so I need the rewrite to catch http://something.mywebsite.com/area/"this_part_here"
from the indexMapContents1.php file but I also need that same part
used in the indexMap1.php file...

Any suggestions on how I could do this would really help. I've already
spent so much time on this and the only alternative I found was to
create a cookie in indexMap1.php and get it back in
indexMapContents1.php

Thanks
Kentor [ Mi, 09 Mai 2007 03:30 ] [ ID #1708150 ]

Re: suggestion needed

On May 9, 2:30 am, Kentor <ken... [at] gmail.com> wrote:
> Hello,
>
> Is there a way to have a rewrite done for two files for the same path?
> like this:
>
> RewriteRule ^area/(.*) indexMap1.php?area=$1 [L,QSA]
> RewriteRule ^area/(.*) indexMapContents1.php?area=$1 [L,QSA]
>
> Your probably thinking "why would you wanna do that?"
>
> The reason why I want to do this is because indexMap1.php is accessed
> with a subdomain as following:http://something.mywebsite.com....
> something goes into some var already before these 2 rewrite rules this
> way:
>
> RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mywebsite\.com
> RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
> RewriteRule ^$ indexMap1.php?location=%2 [L,QSA]
>
> now, inside my indexMap1.php file I'm using indexMapContents1.php as a
> javascript like this:
>
> echo "<script type=\"text/javascript\" src=\"/indexMapContents1.php
> \"></script>";
>
> and then inside that file I tell it that its actually a JS file and
> not a php...
>
> so I need the rewrite to catchhttp://something.mywebsite.com/area/"this_part_here"
> from the indexMapContents1.php file but I also need that same part
> used in the indexMap1.php file...
>
> Any suggestions on how I could do this would really help. I've already
> spent so much time on this and the only alternative I found was to
> create a cookie in indexMap1.php and get it back in
> indexMapContents1.php
>
> Thanks

http://something.mywebsite.com/area/region_name
-->
indexMap1.php?location=region_name

inside indexMap?location=region_name
-------8<-----
$location = filtered($_GET['location']);
#where filtered is a function which makes sure that the location is
checked against allowed values, and that it does not contain html, and
that it is urlencoded.
echo '<script
type="text/javascript"
src="/indexMapContents1.php?area='.$location.'">
</script>';
--------------------------

this would produce markup like so
<script type="text/javascript" src="/indexMapContents1.php?
area=region_name"></script>

inside indexMapContents1.php
---------------8<--------------
$location = filtered($_GET['location']);
//use $location as normal
--------------------------------
shimmyshack [ Mi, 09 Mai 2007 13:12 ] [ ID #1708151 ]

Re: suggestion needed

On May 9, 7:12 am, shimmyshack <matt.fa... [at] gmail.com> wrote:
> On May 9, 2:30 am, Kentor <ken... [at] gmail.com> wrote:
>
>
>
> > Hello,
>
> > Is there a way to have a rewrite done for two files for the same path?
> > like this:
>
> > RewriteRule ^area/(.*) indexMap1.php?area=$1 [L,QSA]
> > RewriteRule ^area/(.*) indexMapContents1.php?area=$1 [L,QSA]
>
> > Your probably thinking "why would you wanna do that?"
>
> > The reason why I want to do this is because indexMap1.php is accessed
> > with a subdomain as following:http://something.mywebsite.com....
> > something goes into some var already before these 2 rewrite rules this
> > way:
>
> > RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mywebsite\.com
> > RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
> > RewriteRule ^$ indexMap1.php?location=%2 [L,QSA]
>
> > now, inside my indexMap1.php file I'm using indexMapContents1.php as a
> > javascript like this:
>
> > echo "<script type=\"text/javascript\" src=\"/indexMapContents1.php
> > \"></script>";
>
> > and then inside that file I tell it that its actually a JS file and
> > not a php...
>
> > so I need the rewrite to catchhttp://something.mywebsite.com/area/"this_part_here"
> > from the indexMapContents1.php file but I also need that same part
> > used in the indexMap1.php file...
>
> > Any suggestions on how I could do this would really help. I've already
> > spent so much time on this and the only alternative I found was to
> > create a cookie in indexMap1.php and get it back in
> > indexMapContents1.php
>
> > Thanks
>
> http://something.mywebsite.com/area/region_name
> -->
> indexMap1.php?location=region_name
>
> inside indexMap?location=region_name
> -------8<-----
> $location = filtered($_GET['location']);
> #where filtered is a function which makes sure that the location is
> checked against allowed values, and that it does not contain html, and
> that it is urlencoded.
> echo '<script
> type="text/javascript"
> src="/indexMapContents1.php?area='.$location.'">
> </script>';
> --------------------------
>
> this would produce markup like so
> <script type="text/javascript" src="/indexMapContents1.php?
> area=region_name"></script>
>
> inside indexMapContents1.php
> ---------------8<--------------
> $location = filtered($_GET['location']);
> //use $location as normal
> --------------------------------

Awsome that worked :) thanks a lot.
Kentor [ Mi, 09 Mai 2007 13:50 ] [ ID #1708153 ]

Re: suggestion needed

On May 9, 12:50 pm, Kentor <ken... [at] gmail.com> wrote:
> On May 9, 7:12 am, shimmyshack <matt.fa... [at] gmail.com> wrote:
>
>
>
> > On May 9, 2:30 am, Kentor <ken... [at] gmail.com> wrote:
>
> > > Hello,
>
> > > Is there a way to have a rewrite done for two files for the same path?
> > > like this:
>
> > > RewriteRule ^area/(.*) indexMap1.php?area=$1 [L,QSA]
> > > RewriteRule ^area/(.*) indexMapContents1.php?area=$1 [L,QSA]
>
> > > Your probably thinking "why would you wanna do that?"
>
> > > The reason why I want to do this is because indexMap1.php is accessed
> > > with a subdomain as following:http://something.mywebsite.com....
> > > something goes into some var already before these 2 rewrite rules this
> > > way:
>
> > > RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mywebsite\.com
> > > RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
> > > RewriteRule ^$ indexMap1.php?location=%2 [L,QSA]
>
> > > now, inside my indexMap1.php file I'm using indexMapContents1.php as a
> > > javascript like this:
>
> > > echo "<script type=\"text/javascript\" src=\"/indexMapContents1.php
> > > \"></script>";
>
> > > and then inside that file I tell it that its actually a JS file and
> > > not a php...
>
> > > so I need the rewrite to catchhttp://something.mywebsite.com/area/"this_part_here"
> > > from the indexMapContents1.php file but I also need that same part
> > > used in the indexMap1.php file...
>
> > > Any suggestions on how I could do this would really help. I've already
> > > spent so much time on this and the only alternative I found was to
> > > create a cookie in indexMap1.php and get it back in
> > > indexMapContents1.php
>
> > > Thanks
>
> >http://something.mywebsite.com/area/region_name
> > -->
> > indexMap1.php?location=region_name
>
> > inside indexMap?location=region_name
> > -------8<-----
> > $location = filtered($_GET['location']);
> > #where filtered is a function which makes sure that the location is
> > checked against allowed values, and that it does not contain html, and
> > that it is urlencoded.
> > echo '<script
> > type="text/javascript"
> > src="/indexMapContents1.php?area='.$location.'">
> > </script>';
> > --------------------------
>
> > this would produce markup like so
> > <script type="text/javascript" src="/indexMapContents1.php?
> > area=region_name"></script>
>
> > inside indexMapContents1.php
> > ---------------8<--------------
> > $location = filtered($_GET['location']);
> > //use $location as normal
> > --------------------------------
>
> Awsome that worked :) thanks a lot.

sorry for the type it should have been
src="/indexMapContents1.php?location='.$location.'">
of course, but I got confused!
shimmyshack [ Mi, 09 Mai 2007 14:11 ] [ ID #1708155 ]

Re: suggestion needed

On May 9, 8:11 am, shimmyshack <matt.fa... [at] gmail.com> wrote:
> On May 9, 12:50 pm, Kentor <ken... [at] gmail.com> wrote:
>
>
>
> > On May 9, 7:12 am, shimmyshack <matt.fa... [at] gmail.com> wrote:
>
> > > On May 9, 2:30 am, Kentor <ken... [at] gmail.com> wrote:
>
> > > > Hello,
>
> > > > Is there a way to have a rewrite done for two files for the same path?
> > > > like this:
>
> > > > RewriteRule ^area/(.*) indexMap1.php?area=$1 [L,QSA]
> > > > RewriteRule ^area/(.*) indexMapContents1.php?area=$1 [L,QSA]
>
> > > > Your probably thinking "why would you wanna do that?"
>
> > > > The reason why I want to do this is because indexMap1.php is accessed
> > > > with a subdomain as following:http://something.mywebsite.com....
> > > > something goes into some var already before these 2 rewrite rules this
> > > > way:
>
> > > > RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mywebsite\.com
> > > > RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com
> > > > RewriteRule ^$ indexMap1.php?location=%2 [L,QSA]
>
> > > > now, inside my indexMap1.php file I'm using indexMapContents1.php as a
> > > > javascript like this:
>
> > > > echo "<script type=\"text/javascript\" src=\"/indexMapContents1.php
> > > > \"></script>";
>
> > > > and then inside that file I tell it that its actually a JS file and
> > > > not a php...
>
> > > > so I need the rewrite to catchhttp://something.mywebsite.com/area/"this_part_here"
> > > > from the indexMapContents1.php file but I also need that same part
> > > > used in the indexMap1.php file...
>
> > > > Any suggestions on how I could do this would really help. I've already
> > > > spent so much time on this and the only alternative I found was to
> > > > create a cookie in indexMap1.php and get it back in
> > > > indexMapContents1.php
>
> > > > Thanks
>
> > >http://something.mywebsite.com/area/region_name
> > > -->
> > > indexMap1.php?location=region_name
>
> > > inside indexMap?location=region_name
> > > -------8<-----
> > > $location = filtered($_GET['location']);
> > > #where filtered is a function which makes sure that the location is
> > > checked against allowed values, and that it does not contain html, and
> > > that it is urlencoded.
> > > echo '<script
> > > type="text/javascript"
> > > src="/indexMapContents1.php?area='.$location.'">
> > > </script>';
> > > --------------------------
>
> > > this would produce markup like so
> > > <script type="text/javascript" src="/indexMapContents1.php?
> > > area=region_name"></script>
>
> > > inside indexMapContents1.php
> > > ---------------8<--------------
> > > $location = filtered($_GET['location']);
> > > //use $location as normal
> > > --------------------------------
>
> > Awsome that worked :) thanks a lot.
>
> sorry for the type it should have been
> src="/indexMapContents1.php?location='.$location.'">
> of course, but I got confused!

Yea you almost got it right the first time... I just needed this part:
src="/indexMapContents1.php?area=whatever"... I didn't know I could do
that. Thanks again
Kentor [ Mi, 09 Mai 2007 19:42 ] [ ID #1708159 ]
PHP » alt.php » suggestion needed

Vorheriges Thema: How do I read a php file into a php program
Nächstes Thema: PHP Warning: Module 'readline' already loaded in Unknown on line 0