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条)

报告相同问题?

悬赏问题

  • ¥18 深度学习tensorflow1,ssdv1,coco数据集训练一个模型
  • ¥100 关于注册表摄像头和麦克风的问题
  • ¥30 代码本地运行正常,但是TOMCAT部署时闪退
  • ¥15 关于#python#的问题
  • ¥15 主机可以ping通路由器但是连不上网怎么办
  • ¥15 数据库一张以时间排好序的表中,找出多次相邻的那些行
  • ¥50 关于DynamoRIO处理多线程程序时候的问题
  • ¥15 kubeadm部署k8s出错
  • ¥15 Abaqus打不开cae文件怎么办?
  • ¥15 小程序准备上线,软件开发公司需要提供哪些资料给甲方