pixie123 pixie123 - 1 year ago 109
Apache Configuration Question

Use .html pages with WordPress

I have wordpress in the same directory as my static .html pages. How can i make it so that when i want to visit example.com/test-page it will automatically go to the html version if there is a html version.

If there is no .html version, then it will go to the wordpress version. how can i do that? thanks

i have tried this:

DirectoryIndex index.html index.php

but i think that only for index page. how can i do it globally? maybe thru .htaccess?

Answer Source

You can use the following rule :

RewriteEngine on

RewriteCond %{REQUEST_FILENAME}.html -f
 RewriteRule ^(.*?)/?$ /$1.html [L]

This will internally redirect html requests eg : /page/ to /page.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download