Reply to Re: rewrite for sub-domains...

Your name:

Reply:


Posted by Rik on 12/09/06 04:02

Kentor wrote:
> RewriteCond %{HTTP_HOST} !^www <- this is for not catching some
> subdomains?

Yep. You might want to skip 'www', 'forum' etc., those kind of subdomains.
Although it would be better to match up to the dot:
RewriteCond %{HTTP_HOST} !^www\.

wwwwhat.example. won't be accidantly matched in that case.

> #(Or any other subdomains you don't want to catch)
> RewriteRule ^(.*)$ searchForm.php?location=%1&foo=$1 [L,QSA]
>
> and whats 'foo' for? this is for another variable which i dont need i
> guess right?

Well yeah, take for instance the url:
http://subdomain.example.net/thisisextra.html

Now, regardless of 'thisisextra.html', you always redirect to
searchForm.php?location=subdomain. It's pretty likely you want to be able
to navigate to different locations on your pseudo-subdomain. That's where
'foo' steps in. Read it at the top of the script, and determin what actual
page should be shown. Alternativly you could browse with only explicit GET
vaiables (so subdomain.example.net/?details), which will be available by
the QSA flag. Users that try to type the url manually tend to forget things
like the questionmark, s I'd seriously consider to catch if in a variable
like 'foo' or whatever.

Another problem we face now is this:
If the user types:
subdomainA.example.net/?location=subdomainB
subdomainB is the last variable set, and will be in you $_GET['location'].

You might want to alter it to:
RewriteRule ^(.*)$ searchForm.php?%{QUERY_STRING}&location=%1&foo=$1 [L]
But that's up to your actual design.

--
Grtz,

Rik

[Back to original 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

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