You are here: Re: rewrite for sub-domains... « All PHP « IT news, forums, messages
Re: rewrite for sub-domains...

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация