Link to home
Start Free TrialLog in
Avatar of scottyh56
scottyh56

asked on

help please - 301 redirect not working

For the last 2 years I have had a .htaccess file redirecting traffic from www.scottyh.com to www.scottyh.net as follows:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?scottyh\.com
RewriteRule ^.* http://www.scottyh.net/index.htm [R=301,L]

Earlier today it passed the test here......

http://www.webconfs.com/redirect-check.php

...and still does.

Now I want scottyh.net to redirect all traffic to the home page of www.lighttouchimages.co.uk. So I cribbed from the above and set up the following:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?scottyh\.net
RewriteRule ^.* http://www.lighttouchimages.co.uk/index.htm [R=301,L]

But this does not work and does not pass the test at http://www.webconfs.com/redirect-check.php

Any help appreciated!

Thanks

Scott
Avatar of ShaneJones
ShaneJones
Flag of United Kingdom of Great Britain and Northern Ireland image

Try this instead

if scotty.net index page is index.php

Redirect 301 /index.php "http://www.lighttouchimages.co.uk/"

otherwise change the php for html htm asp cfm or whatever
Avatar of Roshaoar
Roshaoar

As per the message on the site, what does your error log say? :)

One mistake I sometimes make is forgetting to use the correct permissions on the .htaccess - it should be set at 755
Avatar of scottyh56

ASKER

I've now tried;
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?scottyh\.net
Redirect 301 /index.htm "http://www.lighttouchimages.co.uk/"
and
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?scottyh.net
Redirect 301 /index.htm "http://www.lighttouchimages.co.uk/"

I've also set permissions to 755...

Sorry, no luck.
just use this 1 line after RewriteEngine on

Redirect 301 /index.php "http://www.lighttouchimages.co.uk/"

ignore all of the
RewriteCond %{HTTP_HOST} ^(www\.)?scottyh\.net
part as this is not needed
sorry meant to change it to htm

Redirect 301 /index.htm "http://www.lighttouchimages.co.uk/"

hmmm, so I still get http://www.scottyh.com redirecting to http://www.scottyh.net/index.htm and the error is on http://www.scottyh.net/index.htm. Which might indicate to me that the .com bit hasn't actually been changed. Are you sure you're changing the right one?

Try completely deleting the .htaccess file on http://www.scottyh.com, then doing it afresh

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?scottyh\.com
RewriteRule ^.* http://www.lighttouchimages.co.uk/" [R=301,L]


Hi
Same problem is seen. I've also tried the simple
Redirect 301 / http://www.lighttouchimages.co.uk
No luck.....

The problem you're seeing isn't on .com. it's on .net. If there were a problem on .com the address would show the error when you're on .com. The error is on .net - and I think you're putting the .htaccess you mean to put onto .com onto .net, and you're gettin internal errors on .net because of that.
I've now deleted the file I've been playing with from .net and you can now see the .net site.

If you go to www.scottyh.com you'll see how the .htaccess file works fine there, taking you to .net.

The two sites are completely different hosts.

There is something strange going on here I know, but I know not what it is....
Changed scottyh.com now to:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?scottyh\.com
RewriteRule ^.* http://www.lighttouchimages.co.uk/index.htm [R=301,L]

Works fine. So why not on .net???
ASKER CERTIFIED SOLUTION
Avatar of Roshaoar
Roshaoar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hm, try giving pipex a call in the am. From this chart it looks like there might be some domain confusion - you have the same one twice?

http://uptime.netcraft.com/up/hosted?netname=UK-PIPEX-LEEDS-DCO-1,81.21.75.0,81.21.75.127
Yes - not there now but it has been in that form (and the others above) and not worked.

I've put in a support request to the host.

I'll be putting the .htaccess file back shortly in the form in the last post so they can see the effect.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK - the host has my email - perhaps they will be able to fix.

If they can't then what is the alternative for a 301 redirect of all traffic looking for www.scottyh.net or files in www.scottyh.net?

I could clear everything out and put up index.php with a php redirect but that would not nail people looking for www.scottyh.net/index.htm etc

Thanks
> I could clear everything out and put up index.php with a php redirect but that would not nail people looking for www.scottyh.net/index.htm etc

Yes, that would be an option.

ErrorDocument 404 http://example.com  (will issue a 302 redirect)   or
ErrorDocument 404 /index.php   and send a 301 via php

would be another option. But ErrorDocument overrides FileInfo, too, so that won't work as well if AllowOverride is not set to FileInfo in httpd.conf/server configuration.
the host has confirmed that it's their server settings causing the problem.

I've set a php redirect in index.php as follows:

<?
header( "HTTP/1.1 301 Moved Permanently" ); //the original page was http://www.scottyh.net/index.htm
header( "Location: http://www.lighttouchimages.co.uk" );
exit();
?>

which seems to work fine and has the benefit of allowing people to still go direct to old galleries on the site.

I've allocated some points.

Thanks.