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:29

Kentor wrote:
> yay it finally started working :) but it works only if i use
> http://montreal.mysite.com or montreal.mysite.com but if i use
> www.montreal.mysite.com or http://www.montreal.mysite.com i still get
> the main page of mysite.com... how can i fix this?
>
> i guess its this line... RewriteCond %{HTTP_HOST} !^www\.
> but if i take it out then even the main page mysite.com points to my
> searchform.php =/

Ah, it's in the same dir as your normal site?
Then I would change it to this:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.mysite\.com
RewriteCond %{HTTP_HOST} !^www\.mysite\.com
RewriteRule ^(.*)$ searchForm.php?location=%2&foo=$1 [L,QSA]

#Note the change from %1 to %2!

Grtz,
--
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

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