replacing .php ext with .html through .htaccess

前端 未结 4 1334
无人及你
无人及你 2020-12-03 03:57

Greetings!

I\'m trying to replace .php extensions with .html

So far I got:

RewriteRule ^(.*)\\.html $1.php

... it works n

4条回答
  •  一生所求
    2020-12-03 04:49

    RewriteEngine on  
    RewriteBase /
    
    RewriteCond %{THE_REQUEST} (.*)\.php  
    RewriteRule ^(.*)\.php $1.html [R=301,L]  
    
    RewriteCond %{THE_REQUEST} (.*)\.html  
    RewriteRule ^(.*)\.html $1.php [L]
    

提交回复
热议问题