douyan9417 2013-04-01 20:55
浏览 33
已采纳

如何重写URL以包含变量并在允许目录时删除php

I have the following htaccess

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?user=$1

which works as expected for example

http://example.com/index.php?user=USERNAME -> http://example.com/USERNAME

However I have created a form on the page index.php which posts to /directory/save.php

How do I remove .php while allowing for the directory so that I can post to /directory/save/ instead?

  • 写回答

3条回答 默认 最新

  • dongzhazhuo0572 2013-04-01 22:29
    关注

    if it is going to one and only such file in /directory then probably hard code it by adding following before the above rules?

    RewriteRule ^directory/save$ /directory/save.php [L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程