So I modified this code that I found elsewhere and stuck it in a plugin. The plugin works; I can see the .htaccess file updated when I hit save on the permalinks page.

add_action( 'init', 'wpse26388_rewrites_init' );

function wpse26388_rewrites_init(){
        'top' );

add_filter( 'query_vars', 'wpse26388_query_vars' );

function wpse26388_query_vars( $query_vars ){
    $query_vars[] = 'cert';
    return $query_vars;


RewriteEngine On
RewriteBase /training/
RewriteRule ^index\.php$ - [L]
RewriteRule ^microsoft/mcsa/ /training/wp-content/microsoft.php?cert=mcsa [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /training/index.php [L]

I can go to /training/wp-content/microsoft.php?cert=mcsa and the page loads. But when I try to access it via /microsoft/mcsa, it does not and gives me a 404.

What gives? And is there any way to enable error logging to see where it's trying to go? Enabling debug mode in wp_config didn't seem to do anything.

  • where is your htaccess file located?
    – Milo
    May 15 '14 at 17:15
  • At the root of the Wordpress install, same directory as wp-config, wp-settings, etc.
    – Ivan
    May 15 '14 at 17:21
  • so, in /training/ ?
    – Milo
    May 15 '14 at 17:21
  • Correct. It is in /training/
    – Ivan
    May 15 '14 at 17:24
  • if you're visiting /microsoft/mcsa/ not within the /training/ directory, that htaccess file never gets parsed.
    – Milo
    May 15 '14 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.