3

On the server there is a static HTML page example.html in my root folder of the WordPress install. Now when a user types www.example.com/example.html I want WordPress to be smart and bypass all normal routing behavior and instead just display that static example.html page.

This looks so easy to me concept-wise but I can't find a solution after looking for hours. What exactly do I need to change in my .htaccess file? Is it even that .httaccess file or do I need to make such a change in the site available file?

Sorry for being a WordPress newbie :(

  • 4
    Please update your question with the contents of your .htaccess file. AFAIK, WordPress's default .htaccess file will allow you to do what you're doing. (See, for example, the readme.html that's installed in the root of WordPress sites.) – Pat J Jan 16 '14 at 17:23
  • 1
    it's already working. my problem was i didnt play attention to linux case sensivity.. – rails_has_elegance Jan 17 '14 at 13:48
  • Why don't you make a custom WP template file to put your HTML code in? That would make more sense to me. Note that you can place raw HTML in your uploads folder by default. – JoostS Jun 8 '16 at 23:43
0

Here is what I have in my own .htaccess file that does what you're looking for:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^example.html$ /wp-content/raw/example.html [L]
RewriteRule ^download$ /wp-content/raw/download-ebook.html [L]
RewriteRule ^thanks$ /wp-content/raw/book-opt-in-thank-you.html [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
0

If there's no reason to bypass the routing you can follow the wp-hierarchy to accomplish this.

https://wphierarchy.com/

For example:

You could create a template-example php file within your theme, then within WordPress you would create a page and set it to the example template in the sidebar.

In your theme, this file would be called: wp-content/themes/theme-name/template-example.php

OR

You could create a blank page within WordPress, set the slug to /example and then create page-example.php

This file would be located here: wp-content/themes/theme-name/page-example.php

Here's where you can find more information: https://developer.wordpress.org/themes/template-files-section/page-template-files/

Your Answer

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

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