Enquire

htaccess- 301 Redirect Old URLs With Spaces

htaccess fun

Here’s a quick and easy htaccess 301 redirect tip.

So, you have a URL like this:
http://www.example.co.uk/this is_a_file.html

and you want to redirect it to:
http://www.example.co.uk/this_is_a_file.html

All you need to is quote the URL like this:

1
Redirect 301 "/this is_a_file.html" http://www.example.co.uk/this_is_a_file.html

Comments

  1. gps spoke on 14/11/2011

    How can I redirect one directory to another? For example:
    Redirect http://domain.ltd/abc/ => http://domain.ltd/xyz/
    (All content still keep alive)
    I tried with no luck, please help me.
    Thanks!

Leave a reply

Your email address will not be published. Required fields are marked *

X