Have redirect issue. I want to make rewrite extension from php to html all of my url’s so i add this rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?).html$ $1.php [NC,L]
Works amaizing, i can view page when i go to example: /index.html
But its not good for SEO because when i can visit page also from index.php …
How to make good redirect? When i try redirect using this code:
RewriteCond %{REQUEST_URI} ^/index.php$ [NC]
RewriteRule ^index.html /index.php [R=301,L,NC]
It’s not working not redirect… Where I make a mistake?
2
Answers
You need an additional rewriterule to internally redirect /index.html to /index.php try :
Don’t make a redirect but serve php as html like this:
(You have to rename your file.php into file.html)