Creating a Simple .htaccess redirect

Creating a Simple .htaccess redirect

RedirectMatch uses a regular expression that is matched against the URL path. And your regular expression /contact.php just means any URL path that contains /contact.php but not just any URL path that is exactly /contact.php. So use the anchors for the start and end of the string (^ and $):

RedirectMatch 301 ^/contact\.php$ /contact-us.php

redirect 301 /contact.php /contact-us.php

Share

Leave a Reply

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