Search code examples
.htaccesshttp-status-code-301

Issue with simple 301 redirect


In my .htaccess file I have the following redirect:

Redirect 301 /concrete5-themes/street/ http://www.c5themes.co.uk/street-theme-for-concrete5/

However, this sends you to http://www.c5themes.co.ukstreet which is obviously wrong.

What's wrong?

Thanks Dave


Solution

  • Give this a try at the top of your .htaccess:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^(www\.)?c5themes\.co\.uk$
    RewriteRule ^concrete5-themes/street(.*) http://www.c5themes.co.uk/street-theme-for-concrete5/ [R=301,L]
    

    Example inputs:

    http://www.example.co.uk/concrete5-themes/street/1/1
    http://www.example.co.uk/concrete5-themes/street

    Redirect:

    http://www.c5themes.co.uk/street-theme-for-concrete5/


    You can experiment here: http://htaccess.madewithlove.be/