Domain rewrite - Need help with trailing slashes!

Using a single web hosting account to host multiple sites

Domain rewrite - Need help with trailing slashes!

Postby VMAN » Sun Apr 05, 2009 3:42 pm

I am rewriting my domain vmancentral.com to point to virtualhosts/vmancentral/

Code: Select all
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^vmancentral\.com [NC]
RewriteRule (.*) http://www\.vmancentral\.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} www\.vmancentral\.com|vmancentral\.com [NC]
RewriteCond %{DOCUMENT_ROOT}/%2%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]
RewriteCond %{HTTP_HOST} www\.vmancentral\.com|vmancentral\.com [NC]
RewriteRule (.*) virtualhosts/vmancentral/$1 [NC,L]


Everything works the way I want; the www. is being forced, it is pointing to the right folder.

When I go to http://www.vmancentral.com/addons it goes to http://www.vmancentral.com/addons/ like it is supposed to :D

But when I go to http://www.vmancentral.com/addons/forum it goes to http://www.vmancentral.com/virtualhosts ... ons/forum/

I want it to go to http://www.vmancentral.com/addons/forum/

Please help :D
VMAN
 
Posts: 2
Joined: Sun Apr 05, 2009 3:35 pm

Postby richardk » Mon Apr 06, 2009 2:14 pm

Code: Select all
RewriteCond %{DOCUMENT_ROOT}/%2%{REQUEST_URI}/ -d

You've removed the bit that sets %2.

Code: Select all
Options +FollowSymLinks

RewriteEngine On


RewriteCond %{HTTP_HOST} ^(www\.)?vmancentral\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/virtualhosts/vmancentral%{REQUEST_URI}/ -d
RewriteRule [^/]$ http://www.vmancentral.com/%{REQUEST_URI}/ [R=301,L]

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

RewriteCond %{HTTP_HOST} ^(www\.)?vmancentral\.com$ [NC]
RewriteRule ^(.*)$ /virtualhosts/vmancentral/$1 [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby VMAN » Mon Apr 06, 2009 5:08 pm

That fixed it :D

Thank you for your help :)
VMAN
 
Posts: 2
Joined: Sun Apr 05, 2009 3:35 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 16 guests

cron