Search code examples
.htaccesshttp-status-code-301http-redirect

Confirm these 301 redirects are correctly setup in my htaccess file


I need to create a few 301 redirects for a site, basically I need to redirect the following URL :

http://www.oldsite.com/en-gb/resources/ks2/

to

http://www.newsite.com/resources/ks2/

I think the following should be sufficient, can anyone confirm this

Redirect 301 http://www.oldsite.com/en-gb/resources/ks2/ http://www.newsite.com/resources/ks2/

Does this look correct? As it scanned by Google's bot I want to get it correct first time round, thanks in advance

P.S What is the best way/resource people use to confirm their 301 redirects are correctly setup?


Solution

  • Your rule is incorrect since you only match Request URI in the rule. Also better to use RedirectMatch for regex capabilities:

    RedirectMatch 301 ^/en-gb/(resources/ks2/?)$ http://www.newsite.com/$1