Forum Moderators: phranque

Message Too Old, No Replies

301 redirects

the best method

         

whatson

11:31 pm on Aug 3, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want to maintain your position in Google, but have to change the URL, what is the best method?
Do you need to use the rewrite rule? Currently I have:

RewriteEngine on

RewriteRule ^oldurl http://www.example.com/newurl [R=301,L]

Is this acceptable?

[edited by: incrediBILL at 11:54 pm (utc) on Aug 3, 2012]
[edit reason] fixed URLS, use Example.com [/edit]

lucy24

2:11 am on Aug 4, 2012 (gmt 0)

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



Do you need to use the rewrite rule?

Only you can say whether mod_alias (Redirect by that name) will do just as well. Are you asking about whether to Redirect, or how to redirect?

You may be begging the question though. Do you really have to change the URL, or are you only changing it because you've changed the physical filepath?

whatson

3:52 am on Aug 4, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't really have to, but its quite messy, e.g. page_name_c12_53.

Do you not think I should change it?

I am fairly new at all these redirects I don't really understand what a rewrite rule even is, so not sure what redirect to be using really.

lucy24

8:14 am on Aug 4, 2012 (gmt 0)

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



Yuk. If you're changing it to something shorter and snappier, it will probably be a good idea in the long term even if there's a temporary downward hiccup.

A RewriteRule is a means to an end, where your desired end is a Redirect.

A Redirect means that the user asks for URL A and you grab them and send them over to URL B instead. The URL does not have to correspond to the name and location of the physical files, though it's definitely easier when they are the same!

RewriteRule ^oldurl http://www.example.com/newurl [R=301,L]


Yup, that's the basic pattern, with the correct flags. Details will depend on how many URLs you're talking about, and whether there's any predictable relationship between the old URL and the new one.

You generally only need to redirect requests for pages or directories. Nobody cares what your styles sheets are called or where they live. Well, nobody but you ;)