Reply to Re: redirect to directory - php redirect or htaccess?

Your name:

Reply:


Posted by deko on 12/16/85 11:51

> Most likely not. The browser will look for the domain wwwXexample.com
> instead of example.com. the same is true for www.exampleYcom. The
> only thing that it could ever really match is a period because of how
> it has to be formatted.

I see. I suppose it doesn't make much difference. But those who have a penchant
for exacting code are likely to use the escape characters.

In any case, I think I've got it working:

RewriteEngine on
Options All -Indexes
RewriteCond %{HTTP_HOST} ^www\.deadsite\.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^deadsite\.com$ [NC]
RewriteRule (.*) http://10.10.10.10/deadsite.com [L]
#the above rule sends deadsite requests into hyperspace (there is a reason for
this)
RewriteCond %{HTTP_HOST} ^www\.site1\.org$ [NC,OR]
RewriteCond %{HTTP_HOST} ^site1\.org$ [NC]
RewriteCond %{REQUEST_URI} !^/site1/.*$
RewriteRule ^(.*)? /site1/$1 [L]
#this rule catches any request for "www.site1.com" or "site1.com"
#and sends it to the /site1 directory in public_html

I have no idea what REQUEST_URI is doing or what the regex in the last
RewriteRule is doing, but it works... so far, anyway. I am still testing.

Another question:

What does the [L] do and is it necessary? (the code seems to break if I don't
use it)

I will also try stacking up several domains (pointing to several subdirectories)
this way. Is there any problem with having several conditions and rewrite
rules? The file is just read sequentially, correct?

[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

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