a one-off rewrite rule

I have one page that I need to change the URL for.

Currently, the page resides at example.com/departments/human-resources/

Read More

(human-resources is a sub-page of /departments/ )

My client wants to maintain the legacy url for the hr department which is:

http://example.com/hr/

How can I rewrite any request for ^/hr/?$ to ^/departments/human-resources/$ but keep the URL the same?

That is, nobody will ever see /departments/human-resources/.

My current .htaccess looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I’ve tried adding a rewrite rule that writes /hr/ to /dept/h-r/ before the index.php line, but this gives me a 404.

Related posts

Leave a Reply

2 comments

  1. Redirection allows you to modify post slugs and keeps a history of them, pointing all requests for the history of a page to the same destination. It’s useful for all sorts of other things too, but it will definitely solve this problem.

  2. One time rewrite rules are actually built into the post type edit/new UI.

    You can either use the Permalink edit line below the title or open the Screen Options tab and set the meta box to visible (check the checkbox).

    enter image description here