Forum Moderators: phranque

Message Too Old, No Replies

IP redirect

         

Moncao

8:04 am on Jan 30, 2007 (gmt 0)

10+ Year Member



Hi

The spectre was raised on the members forum regarding Google listing a site by IP and therefore creating a possible suplimental / duplicate material problem. Marcia kindly put up an Apache redirect but suggested to make sure here it is OK;

RewriteCond %{HTTP_HOST} ^12\.34\.56\.78
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Is that golden?

jdMorgan

3:50 pm on Jan 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Golden? No.

Mod_rewrite code can almost never be "golden," because *you* must decide what functions you want and need for your site.

For example, what about the non-www variation, which can also cause duplicate listings? You can add a function to take care of that, too:


RewriteCond %{HTTP_HOST} ^12\.34\.56\.78 [OR]
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

The main point being that the code itself was OK, but it may or may not do exactly what you want -- or all that you want to do.

The hardest thing about server configuration is deciding precisely what you want and need to do. Once that is done, only coding and testing remain. And those latter two parts of the job are the easy parts. :)

Jim

Moncao

7:52 am on Jan 31, 2007 (gmt 0)

10+ Year Member



jdMorgan
Thanks, I had the non www element in already. Thanks for the shortening of code of what I wanted to do.