Jeff Jeff - 1 year ago 71
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?

Answer Source

Yes, it can be done using a RedirectMatch rule.

Place this rule in your site root .htaccess:

RedirectMatch 301 ^/(articles)/\d+-(.+)$ /$1/$2
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download