Forum Moderators: bakedjake
Primary Domain: abc.com
Addon Domain: xyz.com (located in a subfolder named xyz, under abc.com)
Before adding the second domain, I was using the following line to redirect traffic to my phpbb folder...
redirect /index.html [abc.com...]
Now I am unable to access the new, addon domain. All requests to xyz.com are forwarded to [abc.com...] My host says the redirect is to blame.
Ok...here is what I need to achieve.
1. All requests for [abc.com...] or [abc.com...] are directed to [abc.com...] I also want to make sure the path, "http://www.abc.com/phpbb/index.php" still shows in the browser's address bar.
2. All requests for [xyz.com...] or [xyz.com...] are direct to [xyz.com...] and look to the "xyz" subfolder as it's "root".
I attempted adding a mod_rewrite command for the addon domain, but it does not work. Again, as told by host, the redirect is breaking the rewrite
Current .htaccess:
redirect /index.html [abc.com...]
RewriteEngine on
RewriteCond $1!^(xyz.com)/
RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.(com好et她rg)))
RewriteRule (.*) /%2/$1 [L]
Thanks for help,
Brian
Welcome to WebmasterWorld!
The trick here is to make the redirects/rewrites mutually-exclusive.
# Rewrite /index.html to /phpbb/index.php for abc.com only
RewriteCond %{HTTP_HOST} ^(www\.)?abc\.com
RewriteRule ^index\.html$ /phpbb/index.php [L]
#
# Rewrite other domains to subfolders
RewriteCond %{HTTP_HOST} ^(www\.)?(list_of_valid_subfolders)\.(com好et她rg)
RewriteRule (.*) /%2/$1 [L]
Jim
# Rewrite /index.html to /phpbb/index.php for abc.com only
RewriteCond %{HTTP_HOST} ^(www\.)?abc\.com
RewriteRule ^index\.html$ /phpbb/index.php [L]
#
# Rewrite other domains to subfolders
RewriteCond %{HTTP_HOST}!^www\.(xyx)\.com
RewriteCond %{HTTP_HOST} ^(www\.)?(xyz)\.(com好et她rg)
RewriteRule (.*) /%2/$1 [L]
I only have one domain that will be forwarded to a subfolder.
Thanks,
Brian
# Rewrite /index.html to /phpbb/index.php for abc.com only
RewriteCond %{HTTP_HOST} ^(www\.)?abc\.com
RewriteRule ^index\.html$ /phpbb/index.php [L]
#
# Rewrite xyz domain to subfolder
RewriteCond %{HTTP_HOST} ^www\.xyz\.com
RewriteCond %{REQUEST_URI}!/xyz/
RewriteRule (.*) /xyz/$1 [L]
Here are my results
[abc.com...] (shows directory structure)
[abc.com...] (shows directory structure)
[xyz.com...] (500 error)
[xyz.com...] (goes to [xyz.com...] rather than [xyz.com,...] but does load the correct index.html file)
I also tried prefacing the code with...
RewriteEngine on
but it did not make a difference.
Thanks for all your help! I wish I could be more informative in my replies.
Brian