Force Rewrite for https and .html to .php in htaccess

/ Published in: Apache
Save to your folder(s)

This rewrite will not work on WordPress. It forces .htm and .html files that no longer exist to go to the new .php versions of the pages.

Copy this code and paste it in your HTML
  1. RewriteEngine On
  2. RewriteCond %{HTTPS} !=on
  3. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
  5. RewriteRule ^(.*)\.htm /$1.php [R=301,L]
  6. RewriteRule ^(.*)\.html /$1.php [R=301,L]

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.