Lets say I want to rewrite URLs from one subdirectory to another (my actual use case is a bit more complicated but this is a simpler example):

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule    ^pretty_prefix/(.*)$    ugly_dir_name/$1

The plan is that the user sees URLs like:


instead of


Inside public_html/ugly_dir_name there's a .htaccess file like the following:

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

Unfortunately, it seems as though Wordpress, after catching the URL with the last catch all rule, is doing something that results in the pretty URL not being displayed to the user.

Is there anyway to fix this?

  • When you have an hammer, every problem is a nail :). You actually don't have enough context about what exactly those urls are, but in general it seems that the question show a deep misunderstanding of how wordpress handlers URL. htaccess changes by themself can usually be only part of the solution. – Mark Kaplun Apr 6 '16 at 16:57
  • Have you enabled "pretty" permalinks? Read Codex for details on that setting. – kaiser Apr 6 '16 at 22:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.