- Code: Select all
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteCond %{HTTP_HOST} (.*)three....
RewriteCond %{REQUEST_URI} !home/
RewriteRule ^(.*)$ home/$1 [R,L]
#removes leading www. from main url
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^onetwo\.net
RewriteRule (.*) http://onetwo.net/$1 [R,L]
I have onetwo.net on my hosting root with a test page for a second small site i want to build residing in onetwo.net/home
I have several domains for the second site:
onetwothree.com
onetwothree.net
onetwothree.org
three.net
using the above code, all incoming requests for the last 4 domains how load the test index page in onetwo.net/home
the next part of what I am trying to do is: for any content in /home, the browser should display http://one.two.three.net in the address bar, without showing any trailing folder or file name..
for example, at the moment:
three.net -loads-> onetwo.net/home -but displays-> http://onetwo.net/home
onetwothree.com -loads-> onetwo.net/home -but displays-> http://onetwo.net/home
onetwothree.net -loads-> onetwo.net/home -but displays-> http://onetwo.net/home
onetwothree.org -loads-> onetwo.net/home -but displays-> http://onetwo.net/home
one.two.three.net -loads-> onetwo.net/home -but displays-> http://onetwo.net/home
what i want to happen is:
three.net -loads-> onetwo.net/home -but displays-> http://one.two.three.net
onetwothree.com -loads-> onetwo.net/home -but displays-> http://one.two.three.net
onetwothree.net -loads-> onetwo.net/home -but displays-> http://one.two.three.net
onetwothree.org -loads-> onetwo.net/home -but displays-> http://one.two.three.net
one.two.three.net -loads-> onetwo.net/home -but displays-> http://one.two.three.net
also, the address for anything on the one.two.three.net domain (and therefore within /home) shouldnt show the trailing folder name, or file name (if thats even possible?), for example:
one.two.three.net/whatever.html -loads-> onetwo.net/home/whatever.html -but displays-> http://one.two.three.net
one.two.three.net/subfolder -loads-> onetwo.net/home/subfolder -but displays-> http://one.two.three.net
at the moment, I think I am coming up against problems due to the similarities within each domain name and it is causing constant loops whenever i try to force one.two.three.net to show because my expression is "(.*)three....".
Its taken about 2 weeks of messing with it to get this far, but i think im trying to do something that far exceeds my knowledge of mod_rewrite.. so any help would be greatly appreciated.
TIA.