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

Your name:

Reply:


Posted by Kentor on 12/15/06 16:40

Ok this is really strange... =/ nothing works.

If i use the 3 lines you gave me:

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

then my whole website is dead and i get this everywhere:

Internal Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.

Please contact the server administrator, webmaster@mysite.com and
inform them of the time the error occurred, and anything you might have
done that may have caused the error.

More information about this error may be available in the server error
log.

Additionally, a 500 Internal Server Error error was encountered while
trying to use an ErrorDocument to handle the request.


======
if i use these 4 lines:

RewriteCond %{HTTP_HOST} (.+)\.mysite.com
RewriteCond %{HTTP_HOST} !='www.mysite.com'
RewriteRule ^$ /searchFormHousing.php [L,QSA]
RewriteRule ^/.*$ /searchFormHousing.php [L,QSA]

then after going to montreal.mysite.com i get to the homepage of
mysite.com...
its like trying to talk to mysite.com a few times.. it says waiting
response from mysite.com the reading from mysite.com and then again 3
times... but always shows me the homepage... but if i go straight to
the homepage it loads quickly in one shot so ... =/

Now, if i remove these 4 lines and not have anything concerning the sub
domain... it does the same thing as if i had those 4 lines in the
..htaccess.... so their not really doing anything...

note: I don't have a * DNS set... I added montreal.mysite.com
manually... but this should still work... in order to set a * dns i
have to contact the hosting company and they say there are problems
with this and so on... but if i really need it they can add it... but
for now i want to try and figure it out with one subdomain... =/

please help :)

Rik wrote:
> 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

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