Hide extension in .htaccess

后端 未结 4 629
刺人心
刺人心 2021-01-15 03:50

Hi All i have a problem that my file have .html extention but i want that when the file open in brownser the extention had hidden.e.g file.html to file. Advance thanks

4条回答
  •  独厮守ぢ
    2021-01-15 04:41

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([^/]+)/$ $1.php
    RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
    RewriteRule (.*)$ /$1/ [R=301,L]
    

    Example yoursite.com/wallpaper.html to yoursite.com/wallpaper/

提交回复
热议问题