I’ve built a website creator but am having problems with the domains.
The client website urls are as follows: http://www.maindomain.com/userdomain.com (already using mod_rewrite).
I am now trying to point a top level domain at the already rewritten url. Sadly that doesn’t seem to work:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^(ww+\.)?(.+)$ [NC]
RewriteCond %2 !^maindomain.com
RewriteRule ^(.*)$ /%2/$1 [L]
Funnily enough it works fine as a redirect:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^(ww+\.)?(.+)$ [NC]
RewriteCond %2 !^maindomain.com
RewriteRule ^(.*)$ http://www.maindomain.com/%2/$1 [L]
This isn’t an really an option though as visitors shouldn’t be able to see my domain.
Any ideas what I’m doing wrong?
Any help would be greatly appreciated!
Thanks in advance!
You will have to use mod_proxy [P Flag].