www.domain.com/directory => www.directory.com

Using a single web hosting account to host multiple sites

Postby germanicus » Mon Apr 23, 2007 10:14 am

good point:

Code: Select all
#Options +FollowSymLinks
#RewriteEngine On

#RewriteCond %{ENV:REDIRECT_STATUS} ^$
#RewriteRule ^catalog(/(.*))?$ http://www.domain.de/$2 [R=301,L]

#RewriteCond %{HTTP_HOST} ^(domain\.de)$ [NC]
#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

#RewriteCond %{ENV:REDIRECT_STATUS} ^$
#RewriteCond %{HTTP_HOST} ^(www\.)?domain\.de$ [NC]
#RewriteCond %{SCRIPT_FILENAME} !-f
#RewriteRule !^(folders|to|exclude)(/.*)$ /catalog%{REQUEST_URI} [QSA,L]


Thx heaps!
germanicus
 
Posts: 4
Joined: Sun Apr 22, 2007 11:44 pm

Postby richardk » Mon Apr 23, 2007 10:25 am

Try adding the DirectoryIndex directive
Code: Select all
DirectoryIndex index.php index.html index.htm etc.


And replacing the last section with
Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.de$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /catalog/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby germanicus » Mon Apr 23, 2007 11:21 am

Thanks for your quick reply.

With the suggested code, in spite of DirectoryIndex directive, the index files won't work in neither the root, nor in the additional folders in root.
With the lines commented out. The index worked in the root/catalog folder, but not in the excluded folders in the root dir.

Should I add the DirectoryIndex to additional .htaccess files in the respective subfolders?
So close and yet so far ;)

Code: Select all
Options +FollowSymLinks
DirectoryIndex index.php index.html index.htm
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^catalog(/(.*))?$ http://www.merseysite.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(merseysite\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

#RewriteCond %{ENV:REDIRECT_STATUS} ^$
#RewriteCond %{HTTP_HOST} ^(www\.)?merseysite\.com$ [NC]
#RewriteCond %{SCRIPT_FILENAME} !-f
#RewriteRule !^(folders|to|ignore)(/.*)$ /catalog%{REQUEST_URI} [QSA,L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?merseysite\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ /catalog/$1 [QSA,L]
germanicus
 
Posts: 4
Joined: Sun Apr 22, 2007 11:44 pm

Postby richardk » Mon Apr 23, 2007 11:36 am

I have no idea why it would stop DirectoryIndex working, try
Code: Select all
Options +FollowSymLinks
DirectoryIndex index.php index.html index.htm

RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^catalog(/(.*))?$ http://www.merseysite.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(merseysite\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

RewriteRule ^(folders|to|exclude)(/.*)?$ - [L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?merseysite\.com$ [NC]
RewriteRule ^(.*)$ /catalog/$1 [QSA,L]


Should I add the DirectoryIndex to additional .htaccess files in the respective subfolders?

It might work, try it.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Thanks

Postby germanicus » Mon Apr 23, 2007 11:50 pm

Thank you!
Perfect. That did the trick. (even without the Directory Index Directive):

Code: Select all
Options +FollowSymLinks
RewriteEngine On

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^catalog(/(.*))?$ http://www.domain.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

RewriteRule ^(folders|to|exclude)(/.*)?$ - [L]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^(.*)$ /catalog/$1 [QSA,L]
germanicus
 
Posts: 4
Joined: Sun Apr 22, 2007 11:44 pm

Previous

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 27 guests

cron