Forum Moderators: phranque

Message Too Old, No Replies

Firefox Redirect Problem

         

rainborick

5:41 pm on Apr 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm installing a redirect on a client's site to change domain names. I'm using the following code:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?oldsite.net$
RewriteRule ^(.*)$ http://www.newsite.com/$1 [L,R=301]

Internet Explorer seems to handle this properly, and the server header checker I tried shows the correct 301 response and new URL, but my copy of Firefox keeps dumping me into seeq.com like the domain isn't responding properly. Smells like an extension is giving me trouble, but I can't be sure and I can't leave the redirect in place until I have more confidence in it. All I use is the Google toolbar and the Firefox Web Developer and DOM Inspector extensions. Any advice on what I'm seeing would be appreciated.

jdMorgan

7:46 pm on Apr 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



With three corrections and one tweak:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.net [NC]
RewriteRule (.*) http://www.newsite.com/$1 [L,R=301]

this code is correct.

Flush your cache completely in Firefox. You should flush your browser cache before testing any change to your server configuration.

If that doesn't help, then start Firefox in Safe Mode from (Windows) Start->All Programs menu. This will start Firefox with all extensions and themes disabled. If this helps, then go through the add-ons one-by-one, disabling them until you find the one that is causing the problem.

And if you still have trouble, look to your hosts file (location varies, but found in C:\Windows\System32\Drivers\etc on XP. It is named just 'hosts' -- no extension at all. Look in there to see if there is an entry for the domain in question, and if so, comment it out or delete it.

Whatever the problem is, it is client-side, and not server-side. Your code has no test in it for HTTP_USER_AGENT, so it does not know or care what browser or robot makes the request.

I escaped the period, made the hostname compare case-insensitive, and removed the end-anchor from your domain name. This last is to avoid failure of the rule if a port number is attached -- which is a valid possibility. An example of a valid request with a port number would be "http://www.oldsite.com:80/" and your rule as originally written would fail to redirect it.

If you insist on end-anchoring your hostname, then an alternative coding might be either:


RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.net(:(80¦443))?

- or -

RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.net(:[0-9]{1,5})?

Replace the broken pipe "¦" character in the line above with a solid pipe character before use; Posting on this forum modifies the pipe character.

Jim

[edited by: jdMorgan at 7:49 pm (utc) on April 10, 2007]

rainborick

5:34 pm on Apr 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks. Your code works in both browsers just fine, so my cobbled .htaccess must have been bad all along. Appreciate the help.