I have a current site where all URLs end with .html.

I created a new site and the URLs are pretty much the same but without .html.

I've been trying codes found here in my .htaccess file and most seem to cause Internal Server Error.

http://example.com/page1.html to http://example.com/page1/
http://example.com/page1/page2.html to http://example.com/page1/page2/

My current .htaccess file code is:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

1 Answer 1


Just to note, when you get an Internal Server Error (code 500), you should check your server's error log for the specifics of the error. If you've been messing with mod_rewrite in .htaccess then this could be anything from a basic syntax error to a rewrite loop.

If you have no .html files on your new site then you can issue an unconditional redirect to remove the .html on the end of the URL. For example:

RewriteRule (.*)\.html$ /$1 [R=301,L]

This would need to go before the existing WordPress directives.

Or, if you do have some .html files that need to be served as-is then only redirect requests that do not map to an existing file. For example:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)\.html$ /$1 [R=301,L]

You will need to clear your browser cache before testing.

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.