Jeff Jeff - 20 days ago 4x
PHP Question

htaccess Page Redirect to URL with no page ID

This URL

needs to be redirected to this URL

Here is another example:


The client wants the page id removed from the URL. Can this redirect be done in the htaccess file or do I need to do it using PHP?


Yes, it can be done using a RedirectMatch rule.

Place this rule in your site root .htaccess:

RedirectMatch 301 ^/(articles)/\d+-(.+)$ /$1/$2