Posted by Rik on 12/15/06 18:52
Kentor wrote:
> All my stuff is in one dir but then again i use fake dirs with the
> rewrite rule... so i dunno if need it... but iv been browsing the
> website... and nothing seems to be broken.. so i guess its ok.. =)
>
> thank you, thank you!
>
> Now what do i do to go to another page on montreal.mysite.com like for
> example to show the results for montreal after clicking a form..
> montreal.mysite.com/results.html
> which would normally be resultsOut.php?location=Montreal ...
Well, that's another story:
RewriteEngine On
RewriteBase /
#If no filename is given, direct to searchForm.php
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mysite\.com
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteRule ^$ searchForm.php?location=%2 [L,QSA]
#Else append standard $_GET variable
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mysite\.com
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteRule ^(.*?)$ $1?location=%2 [QSA]
BTW: we're trying to solve everything in .htacces now, but normally I could
use $_SERVER['HTTP_HOST'] just as easily as $_GET['location'] in php
itself....
--
Rik Wasmus
[Back to original message]
|