Forum Moderators: phranque

Message Too Old, No Replies

Still getting 200 when using a 301, any ideas?

         

AmericanBulldog

4:09 pm on Mar 19, 2006 (gmt 0)

10+ Year Member



I'm using what appears to be generic code

RewriteEngine On
RewriteCond %{HTTP_host}!^www\.domain\.com$
RewriteRule ^(.*)$ [domain.com...] [R=permanent,L]

When using the server header checker I still get a 200 code returned

skippy

4:14 pm on Mar 19, 2006 (gmt 0)

10+ Year Member



I use a slightly differant version and it works for me.

Options +FollowSymLinks -Indexes
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ [domain.com...] [R=permanent,L]

AmericanBulldog

4:26 pm on Mar 19, 2006 (gmt 0)

10+ Year Member



Thanks, tried that, still returns HTTP/1.1 200 OK

Any other ideas?

AmericanBulldog

5:33 pm on Mar 19, 2006 (gmt 0)

10+ Year Member



OK, I used this

redirect permanent / [domain.com...]

and got this...

Server Response: [domain.com...]
Status: HTTP/1.1 301 Moved Permanently
Date: Sun, 19 Mar 2006 17:28:02 GMT
Server: Apache
Location: [domain.com...]

Something to do with how my server is configured?

I assume this will still do the job of making sure that a certain SE does not see the non www as dupe content?

AmericanBulldog

6:10 pm on Mar 19, 2006 (gmt 0)

10+ Year Member



Actually, that appeared to have disastorous results...

While it gave me my 301 from non www to www I found I was unable to open any page with a browser...

Back to the drawing board...

jdMorgan

2:43 am on Mar 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The mod_alias Redirect directive fails because it cannot test to see if the request is already being made to the correct domain. So it redirects *all* requests -- including those that it has previously redirected to the correct domain. In other words, it loops until the redirection limit of the browser or server is reached.

If your mod_rewrite code isn't working (it should), then contact your host -- something is amiss with your server.

Jim

AmericanBulldog

11:42 pm on Mar 25, 2006 (gmt 0)

10+ Year Member



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

Appears to have worked for me.

jdMorgan

2:36 am on Mar 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, so you were getting a 200-OK response and no redirect was occurring -- That was not clear.

Options +FollowSymLinks is required to enable mod_rewrite. If it is not already done in the server configuration, you have to do it in .htaccess. Otherwise, mod_rewrite directives will be ignored.

Mystery over.

Jim