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

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

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

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


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]

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.

2 Answers 2


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.


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

  • Unfortunately, I won't be able to removed the /departments/ before the human resources part. by using this method
    – jshawl
    Commented Dec 5, 2012 at 14:32
  • @jessh "How can I rewrite any request for ^/hr/?$ to ^/departments/human-resources/$" clearly states the opposite.
    – kaiser
    Commented Dec 5, 2012 at 16:00
  • no... The request URI would be http://example.com/hr/. This should redirect to http://example.com/departments/human-resources/. Your solution will only let me change whatever comes after /departments/
    – jshawl
    Commented Dec 6, 2012 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.