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 (
RedirectMatch 301 ^/contact\.php$ /contact-us.php
redirect 301 /contact.php /contact-us.php
John McMurray is a freelance PHP developer. Experienced in PHP, Laravel and WordPress he can code anything you need.
Based in Plettenberg Bay, Western Cape I am available for PHP, Laravel or WordPress freelance jobs in Johannesburg, Pretoria, Cape Town, Port Elizabeth. I also often do remote PHP freelance work all over South Africa and the rest of the world.