简单 URL Mod_rewrite
当调用此 URL 时,为什么以下 htaccess 文件会生成 300 错误?
URL: hxxp://subdomain.domainame.com/keyworda/
IndexIgnore *
RewriteEngine on
RewriteRule ^([a-z]+)/$ /index.php?p=$1
错误日志: 300 hxxp://subdomain.domainame.com/keyworda(无尾部斜杠)
Why does the following htaccess file generate 300 errors, when this URL is called?
URL: hxxp://subdomain.domainame.com/keyworda/
IndexIgnore *
RewriteEngine on
RewriteRule ^([a-z]+)/$ /index.php?p=$1
Error log: 300 hxxp://subdomain.domainame.com/keyworda (no trailing slash)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编辑,我试图让我的答案简短,我并不是想让你准确地添加这一行。这只是为了显示缺失的斜线应该去哪里。
我假设您正在 apache 配置目录中编辑 .conf 文件。 Chigley 的答案是假设您正在编辑每个目录的 .htaccess 配置文件。
编辑你的conf文件,如下所示:
一旦它起作用,这就是在您的conf文件中使用的真正的RewriteRule:
如果它不起作用,请编辑您的问题以将完整代码包含在
块,以及您的 httpd 版本,如下所示:
可能并不重要,但以防万一...
这是 mod_write 文档。最底部有一些例子。
Edit, I was trying to keep my answer short, I didn't mean for you to add this line exactly. It was just to show where the missing slash should go.
I'm assuming you are editing a .conf file, in your apache config directory. Chigley's answer is assuming you are editing a per-directory .htaccess config file.
Edit your conf file to look like this:
Once it's working, this is the real RewriteRule to use in your conf file:
If it does not work, edit your question to include the full code in the
block, and your httpd version, like this:
Probably doesn't matter, but just incase...
Here is the mod_write documentation. There are some examples at the very bottom.
你能试试这个吗:
can you try this one:
尝试
Try