Forum Moderators: phranque

Message Too Old, No Replies

Changing URLs. How to redirect correctly?

         

Anon

2:43 am on Mar 9, 2015 (gmt 0)

10+ Year Member



Just hoping to get some help ... I know basic HTML but not great with the programming backend stuff. I'm redesigning my website which is almost complete but I have changed about all the URL's to make them more search engine friendly and easier to understand. A number of these URL's are ranking well in Google so I don't want to lose that advantage. Can any recommend a great (and easy to understand) guide on how I do redirect the URL's properly? Speaking honestly I have a hard time understanding most programming terms. There are about 150 URL's in total so want to make sure I do it correctly from the start. In the past my URL's are terrible and there really isn't a pattern that can be following. Couple of examples:

www.EXAMPLE.com/stressgard-II-night-guard.html changing to
www.EXAMPLE.com/night-guards/stressgard-ii/

www.EXAMPLE.com/DenTek-Comfort-Fit-Dental-Guard.html
www.EXAMPLE.com/night-guards/dentek-comfort-fit-dental-guard/

If I'm needing to write 1 line per redirect for every URL, is this simply the correct coding?

RedirectMatch 301 /stressgard-II-night-guard.html /night-guards/stressgard-ii/
etc

Any help would be most appreciated.

phranque

12:19 pm on Mar 10, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



are you using any mod_rewrite directives?

are you doing anything about hostname canonicalization? (i.e. redirecting non-www to www.example.com)

not2easy

2:43 pm on Mar 10, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



There is a virtual tutorial in the Library here: [webmasterworld.com...] and one of the discussions there is a discussion about the kinds of redirects you want to do: [webmasterworld.com...]

Since this kind of question pops up more than once a week, just browsing the Index for this forum offers many examples. It can be helpful to read a few of those because you can see how sometimes the environment and goals being slightly different can make a lot of difference. From the example URLs posted, this looks like a static to WP change?

lucy24

7:32 pm on Mar 10, 2015 (gmt 0)

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



this looks like a static to WP change

If this is correct (not2easy speaks WP and I don't) then you must use mod_rewrite (RewriteRule...) for your redirects. Put them in your htaccess immediately before the WP envelope.

Anon

12:40 am on Mar 11, 2015 (gmt 0)

10+ Year Member



Thanks for the replies everyone. I will have a good read through the library and hopefully it will make sense to me.

No hostname changes .. I'm just changing shopping carts and new one is in Magento. So updating all the URL's to make them better.

phranque

2:55 am on Mar 11, 2015 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i would assume your magento shopping cart requires mod_rewrite.
in this case you should avoid using mod_alias directives (RedirectMatch) and instead use mod_rewrite directives (RewriteRule) for your external redirects as well.