[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

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
0
scottyh56
Asked:
scottyh56
  • 7
  • 5
  • 3
  • +1
2 Solutions
 
ShaneJonesCommented:
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
0
 
RoshaoarCommented:
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
0
 
scottyh56Author Commented:
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.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
ShaneJonesCommented:
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
0
 
ShaneJonesCommented:
sorry meant to change it to htm

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

0
 
RoshaoarCommented:
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]


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

0
 
RoshaoarCommented:
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.
0
 
scottyh56Author Commented:
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....
0
 
scottyh56Author Commented:
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???
0
 
RoshaoarCommented:
some hosts do disallow stuff like this

presumably the .net one is

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

right?


0
 
RoshaoarCommented:
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
0
 
scottyh56Author Commented:
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.
0
 
caterham_wwwCommented:
Different servers (at least from your http response headers), different settings... your rule posted in your initial posting would be correct, but since nothing happens you may not be allowed to use directives which override FileInfo on that host. In other words: The configuration of that server does not permit those directives in a .htaccess file, they are simply ignored.

> it should be set at 755

Why? Apache needs read permissions only, 644 should be fine. There's no need for write or execute permissions for apache or world (but write for the owner in order to edit the file).
0
 
scottyh56Author Commented:
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
0
 
caterham_wwwCommented:
> 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.
0
 
scottyh56Author Commented:
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 5
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now