domains pointing to subdirs

Using a single web hosting account to host multiple sites

Postby Guest » Sun Dec 02, 2001 8:05 am

Hi,

how can I realize the following with mod_rewrite:

if a requested url starts with http://www.domainA.com/ and does not continue with A/ then rewrite to http://www.domainA.com/A/

for all requests?

e.g.
http://www.domainA.com/ gets http://www.domainA.com/A

http://domainA.com/foo gets
http://www.domainA.com/A/foo

and so on.

Thanks in advance.

Greetings, Oliver
Guest
 

Postby Brett » Fri Dec 07, 2001 6:17 pm

Try something like the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} domaina.com
RewriteCond %{REQUEST_URI} !^/a/
RewriteRule ^(.*) a/$1 [L]

By the way, it seems that the easiest and most reliable way to avoid the possibility accidental infinite loops is to include, in your a/ directory, an .htaccess file containing RewriteEngine off.
Brett
 
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 1 guest

cron