Forum Moderators: phranque

Message Too Old, No Replies

Correct Redirects

Changing site layout, need help with redirects

         

wfernley

1:38 pm on Apr 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey everyone,

I have done some changes to my website so instead of having products.php?id=5 it now says /products/model/index.html.

I will making these changes in my httpd.conf file (I'm not using .htaccess)

I was curious what the correct way of redirecting is. I don't want to have any trouble with Search Engines and I don't want to get my site or pages banned because of having incorrect redirects.

Should I say within the redirct in my httpd.conf file that it is perminent? If so, how should I do that?

Or, can I juse a normal redirect without specificying where it is a perminent or temporary redirect?

Thanks for your help!

Wes

jdMorgan

4:38 pm on Apr 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wes,

> Or, can I juse a normal redirect without specificying where it is a perminent or temporary redirect?

There is no such thing as a "normal redirect" that does not specify 301 or 302 -- It's going to be one or the other. The default is 302.

The other alternative is an internal rewrite where no handshaking with the client is required, and therefore, there is no redirect response code (301 or 302) involved.

The approach I recommend is to rewrite the new static URLs to your script URLs in order to invoke the script, and to 301 redirect any direct requests for the script URLs to the new static URL. This aids in getting your old dynamic URLs replaced, and also may alleviate potential security problems with direct script-URL access.

The general form of this is:


# Rewrite static URLs to invoke script
RewriteRule ^/static/([^/]+)/?$ /dynamic.php?product=$1 [L]
#
# Redirect external requests for dynamic URLs to static URLs
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /dynamic\.php\?product=(.+)\ HTTP
RewriteRule ^/dynamic\.php$ http://www.example.com/static/%1 [R=301,L]

Jim