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.

Leave a Reply

Your email address will not be published. Required fields are marked *