'How to make .htaccess redirect all links to .html suffix
http://advokat-malov.ru/index.php
http://advokat-malov.ru/
http://advokat-malov.ru/index.html
how to make htaccess redirect .php, or seo links(without extension) to .html
how to make it using rewriteCond and rewriteRule or redirectmatch
Solution 1:[1]
This will work
# This will change all .php to .html
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.html$ $1.php [L]
# This will add .html to all urls that are not in the white list
# White list extensions php, html, css, js, less, jpg, png, gif
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(php|html|css|js|less|jpg|png|gif)$
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^(.*)$ $1.html
Solution 2:[2]
in this line:
RewriteRule ^(.*)\.html$ $1.php [L]
You changed the order of php/html.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Simon Hayter |
| Solution 2 | FeniX- |
