February 2, 201511 yr Looking at a website for a friend. Its hosted on ipage. There are limited tools on the ipage control panel, there is however a direct .htaccess editor which I notice has a few other domains hosted. # Begin default subdomain redirect # RewriteEngine on RewriteCond %{HTTP_HOST} ^siteone.com RewriteRule ^(.*)$ http://www.siteone.com/$1 [R=permanent,L] RewriteCond %{HTTP_HOST} ^siteone.co.uk RewriteRule ^(.*)$ http://www.siteone.co.uk/$1 [R=permanent,L] RewriteCond %{HTTP_HOST} ^sitethree.co.uk RewriteRule ^(.*)$ http://www.sitethree.co.uk/$1 [R=permanent,L] RewriteCond %{HTTP_HOST} ^sitetwo.info RewriteRule ^(.*)$ http://www.sitetwo.info/$1 [R=permanent,L] RewriteCond %{HTTP_HOST} ^sitethree.com RewriteRule ^(.*)$ http://www.sitethree.com/$1 [R=permanent,L] #RewriteCond %{HTTP_HOST} ^problemsite.co.uk #RewriteRule ^(.*)$ http://www.problemsite.co.uk/$1 [R=permanent,L] #RewriteCond %{HTTP_HOST} ^problemsite.com #RewriteRule ^(.*)$ http://www.problemsite.co.uk/$1 [R=permanent,L] #RewriteCond %{HTTP_HOST} ^www.problemsite.com #RewriteRule ^(.*)$ http://www.problemsite/$1 [R=permanent,L] # End default subdomain redirect # #ErrorDocument 404 http://www.problemsite.co.uk I have hashed out the problematic ones as the non www redirect on that site redirected all non www traffic for all domains to the www.problemsite. I cannot see why as the rule is quite specific. Why it would do this to all domains. Also can anyone tell me the difference between R=Permanent and R=301? I used permanent as previous automatic entries had used permanent, but I would naturally have gone for 301. I've hashed out the ErrorDocument 404 as I can clearly see why that did all domains. Edited February 2, 201511 yr by paul66beetle
February 2, 201511 yr Hi, The R=permanent and R=301 are the same thing. # Begin default subdomain redirect # RewriteEngine on #RewriteCond %{HTTP_HOST} ^problemsite.co.uk #RewriteRule ^(.*)$ http://www.problemsite.co.uk/$1 [R=permanent,L] #RewriteCond %{HTTP_HOST} ^problemsite.com #RewriteRule ^(.*)$ http://www.problemsite.co.uk/$1 [R=permanent,L] #RewriteCond %{HTTP_HOST} ^www.problemsite.com #RewriteRule ^(.*)$ http://www.problemsite/$1 [R=permanent,L] # End default subdomain redirect # #ErrorDocument 404 http://www.problemsite.co.uk This is madness. I assume there are just 2 domains for problem site, problemsite.com and problemsite.co.uk? Are there 2 sites or just one for problemsite.co.uk with problemsite.com forwarding in? Baffling :s
February 2, 201511 yr Author There are two sites. Four if you include non www. ones. So three rules to direct to the hosted www.problemsite.co.uk if that makes sense. Seems messy having it this way with the .htaccess sitting server side as opposed to the root directory of the site. Not sure whether this was intentional.
February 2, 201511 yr Author Its also a bit weird that it states subdomain redirect but lists hosted domains. Feeling a bit confused.
February 2, 201511 yr Hmmm. This is what I use for non www to the www version. #If the Domain is not www. Rewritecond %{HTTP_HOST} !^www\.domain\.com # Then direct to www version RewriteRule (.*) http://www.domain.com/$1 [R=301,L] The bits i'm stuck on is the 'working' ones as the dots are not escaped?
February 2, 201511 yr Author Yeah I can see the difference. The working ones I believe were created by the host. I followed the same format yet they behaved differently.
February 2, 201511 yr Ah if the others were created by the host (or host cp) then it might be that you're not allowed to overrule certain information with htaccess, maybe this needs to be done via their cp?
February 2, 201511 yr Author The host gives you access to a .htaccess editor. The others were already populated. I am guessing when additional domains were added they added the permanent rules on. This must have been a recent thing as the problematic domain was one of teh first if not the first domain to go on but wasn't listed on the .htaccess. So all I have done via their own panel is to add the above in the same format as theirs.
Create an account or sign in to comment