I want a non-WordPress page that can be accessed from a parent directory that is a WordPress page.

For example, I want http://example.com/city/ to be a WordPress page. However, I want to upload a non-WordPress page into the folder /city/pricing/ on the server. When I try this, I can go to http://example.com/city/pricing/ and it works, but then WordPress won't load http://example.com/city/ because the server sees the /city/ directory and is looking for an index file.

Is it even possible for me to create /city/ as a WordPress page, but have /city/pricing/ as a non-WordPress, static HTML page? If not, I can a different solution, but I wanted to see if this is possible first.

2 Answers 2


As @MarkKaplun suggests, it would be preferable to store this non-WordPress file in a different area of the filesystem altogether and rewrite the URL in .htaccess. Instead of mimicking the WordPress URL in the physical directory structure - which will likely only cause you (more) problems (not least that you would need to override the WordPress front-controller).

For example, instead of saving your non-WordPress page at /city/pricing/index.php, save it at /non-wordress/city-pricing.php (for example) or /non-wordress/city/pricing/index.php (if it helps, in development, to copy the path structure - but this makes no difference to the resulting URL, since this directory structure is completely hidden from the end user).

Then in .htaccess before the WordPress front-controller (ie. before the # BEGIN WordPress section) you can do something like:

RewriteRule ^city/pricing/$ /non-wordpress/city-pricing.php [L]

This internally rewrites /city/pricing/ to /non-wordpress/city-pricing.php - this is entirely hidden from the end user.

But stress, this must go before the WordPress front-controller, otherwise you'll simply get a 404.

  • I should point out that a period in .htaccess is a wildcard, so that needs to be cancelled out like this: RewriteRule ^city/pricing/$ /non-wordpress/city-pricing\.php [L] That tripped me up for a little bit until I realized the issue. Commented May 29, 2018 at 21:11
  • 1
    In what way did that trip you up? The 2nd argument to the RewriteRule directive is not a regex or wildcard expression, it is an ordinary string. The period does not need to be backslash escaped there (it makes no difference if you backslash escape the dot/period or not).
    – MrWhite
    Commented May 29, 2018 at 21:19
  • The file didn't work until I escaped the period. Sorry you don't agree, but that's what happened. Commented May 31, 2018 at 13:41

You can do it by adding a rule to htaccess that will load that page for that specific URL, and add the rule before the wordpress rules. For that it do not make a difference where exactly the page is located on the disk, as long as you write the correct rule.

But for me it just sounds wrong and it is much better to convert the page into a wordpress page template by adding the relevant header and just add it like you add any other wordpress page "underneath" your main page, and since you will probably very quickly realize that you will want to be able to use the wp_footer and wp_head hooks, you are most likely to end doing it in any case.

  • You are correct that it "just sounds wrong". Unfortunately, this isn't my choice. The client wants several pages pre-compiled in Google AMP-compatible HTML files. All of these will be uploaded at /newyork/pricing or /atlanta/pricing/. But /newyork/ and /atlanta/ are already WordPress pages. Because of WordPress's permalink structure, it makes it slightly more complicated to have a page called /pricing/ that is a child page of /newyork/. It keeps trying to redirect to the wrong page, so I'd rather ultimately skip WordPress altogether for these pages. But thank you for your help! Commented May 29, 2018 at 21:15
  • I fully understand, but still uploading an html file and setting up the htaccess rule has the same complexity as creating a page template from the html and creating a page, but in ":your" way you have zero visability into the structure of the site from both the htaccess and wordpress, sides which will mean that it will be much more likely to fail when doing any modification, and in general, the effort to modify "pricing" to "prices" with the htaccess way compared to the wordpress way is just ridiculous, and that is even before talking about handling redirect, integration with SEO etc Commented May 30, 2018 at 2:15
  • you basically not going to use wordpress as CMS which raises the question as to why use wordpress at all? Commented May 30, 2018 at 2:16
  • The site has hundreds of posts and pages. I'm creating about 20 pages that will never change. The client only wants them for SEO purposes, which is why they want them tied into the Google AMP ecosystem. I also don't agree that this is the best way to do it, but it's what they want, so my hands are tied. Thank you for your help, I hope that explains the situation for you. Commented May 31, 2018 at 13:48
  • things that "never change" have a tendency to change much earlier than expected. Commented May 31, 2018 at 17:56

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.