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

报告相同问题?

悬赏问题

  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?