Forum Moderators: phranque
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.primarydomain\.co.uk
rewriterule (.*) [primarydomain.co.uk...] [R=permanent,L]
In addition to the primary domain (mainsite) I have a customer's website that is in a subdirectory.
I.E.
www.primarydomain.co.uk/customer-folder/
When I goto www.bluewidgets-customer.net it is actually sent to www.primarydomain.co.uk/customer-folder/ (although I am the only one that knows this)
Now [bluewidgets-customer.net...] and [bluewidgets-customer.net...] are obviously located in www.mainsite.co.uk but how do I set up mode rewrite for this? Just for clarification [bluewidgets-customer.net...] has the PR and the www.bluewidgets-customer.net doesn't have PR which is why I want to sort this out soon.
Do I add new .htaccess in the sub folder or do I do it in the main directory with different lines of code?
Your help would be very much appreciated!
[bluewidgets-customer.net...] and [bluewidgets-customer.net...] are obviously located in www.primarydomain.co.uk and not the www.mainsite.co.uk mentioned above.
Thanks in advance!
I created a new .htaccess file and added it to the sub folder and it worked.
(With only one small problem) - I wanted to make all [www...] point to http:// - this really slowed things down so I swaped them around (everything points to www) and it all works.
The only thing I can't see is google's tool bar page ranking but that will most likely change through time ;)
Options +FollowSymLinks
RewriteEngine on
#
# If any bluewidgets-customer domain is requested
RewriteCond %{HTTP_HOST} bluewidgets-customer\.net [NC]
# but not the version we want
RewriteCond %{HTTP_HOST} !^bluewidgets-customer\.net
# then 301-redirect to the version we want (This will result in a new HTTP request for the correct domain)
RewriteRule (.*) http://bluewidgets-customer.net/$1 [R=permanent,L]
#
# If correct bluewidgets-customer domain requested, rewrite it to the correct subdirectory
RewriteCond %{HTTP_HOST} ^bluewidgets-customer\.net
# (next line prevents recursion)
RewriteCond %{REQUEST_URI} !^/customer-folder
RewriteRule (.*) /customer-folder/$1 [L]
#
# If not a customer domain, check for non-preferred main domain and redirect if needed
RewriteCond %{HTTP_HOST} !^primarydomain\.co\.uk
RewriteRule (.*) http://primarydomain.co.uk/$1 [R=permanent,L]
Jim