Simple Problem - rewrite to

Using a single web hosting account to host multiple sites

Simple Problem - rewrite to

Postby Minty » Sun Jul 13, 2008 5:25 am

Hello, I'm having trouble with a relatively simple (and, I expect, common) problem rewriting (i.e.) to

I tried something like:

Code: Select all
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub\..*$
RewriteRule (.*)$1

However this alters the visble URL (the one in the address bar) which I'd like to keep as

Is this possible?

Any help appreciated :)
Posts: 5
Joined: Wed May 14, 2008 12:39 pm

Postby richardk » Sun Jul 13, 2008 10:39 am

With no mod_rewrite, do you see the same page when you go to and

Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Add missing trailing slashes.
RewriteCond %{HTTP_HOST} ^sub\.example\.com$ [NC]
RewriteCond %{DOCUMENT_ROOT}/sub%{REQUEST_URI}/ -d
RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

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

Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 1 guest