doujizhong8352 2017-07-09 11:26
浏览 1637
已采纳

从.lp或.html等网址中删除文件扩展名

i want to remove my any extension of file from url of my website.

for example : www.example.ml/dash/logins/sign.php to : www.example/dash/logins/sign/

i had done a loot of google but none of the answer worked for me. i think it didn't worked because in logins folder i have not a single file. there are many other files like index.php, sign.php etc. do i have to kept each file in separate folder or sing.php can change to sign/ also what would happen to this

sign.php?usercode=1

will it get converted to

sign/usercode=1

i alredy have some code present in .htaccess so please give your answer after reffering this code

php_value display_errors Off
php_flag magic_quotes 1
php_flag magic_quotes_gpc 1
php_value mbstring.http_input auto
php_value date.timezone America/New_York


Options -Indexes


RewriteEngine On

RewriteCond %{HTTP_HOST} !^www.example.ml$ [NC]

RewriteRule ^(.*)$ https://www.example.ml/$1 [L,R=301]
  • 写回答

2条回答 默认 最新

  • dq_609586475 2017-07-09 11:35
    关注

    Add this line to your .htaccess file:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ([^\.]+)$ $1.php [NC,L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?