.htaccess 重写不起作用
我需要重写 .htaccess 方面的帮助。
我正在尝试执行以下操作: 当用户输入 http://www.example.com/csc/alabama/
我需要从 http://www.example.com/csc/index.php?state=alabama
提取信息
我认为应该是这样,
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^csc/([^/]*)$ /csc/index.php?state=$1 [L]
我不断收到 404 错误。
顺便说一句,我希望能够使用通用子目录来完成此操作,以便 csc 可以是 abc 或其他任何内容,但这不是优先事项。
I need help with a rewrite in .htaccess.
I am trying to do the following:
When a user types http://www.example.com/csc/alabama/
I need to pull info from http://www.example.com/csc/index.php?state=alabama
I thought it should be this
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^csc/([^/]*)$ /csc/index.php?state=$1 [L]
I keep getting a 404 error.
On a side note, I would like to be able to do this with a generic sub-directory, so that csc could be abc or anything else but this is not the priority.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您忘记了模式中的尾部斜杠。您还应该排除要重定向到的目的地:
You forgot the trailing slash in your pattern. You should also exclude the destination you are redirecting to: