duanji7881 2018-10-02 00:20
浏览 31

我的localhost中的.htaccess没有问题,没有正确重定向

My .htaccess file contains:

Options +FollowSymlinks
RewriteEngine On
RewriteRule projects$ projects.php
RewriteRule projects/$ projects.php
RewriteRule projects/page/([^/]*)$ projects.php?page=$1
RewriteRule projects/page/([^/]*)/$ projects.php?page=$1
RewriteRule projects/company/([^/]*)/$ projects.php?companyid=$1
RewriteRule projects/company/([^/]*)$ projects.php?companyid=$1
RewriteRule projects/([^/]*)$ projects.php?id=$1 [L]

It was working fine, but suddenly this section is not working in my website.

This should redirect to "projects.php?companyid=$firstvariable", but actually, I don't know why.

I tried restarting my PC and deleting temp and restarting WAMP.

  • 写回答

1条回答 默认 最新

  • duanbinmi8970 2018-10-03 20:21
    关注

    After some interactive troubleshooting with OP, it appears that WAMP's Apache/PHP will execute a PHP file that matches the directory portion of the URL path if it exists, before applying the .htaccess RewriteRules.

    In other words, if you have a file named Abc.php, and you request /Abc/def, WAMP's Apache/PHP will just execute Abc.php and not consult the .htaccess file.

    I'm not sure if this is something special about WAMP and whether it's out-of-the-box behavior. I can't find any documentation on being able to control/change this behavior.

    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作