是否需要重启apache才能使.htaccess中的re-write规则生效? [英] Do you have to restart apache to make re-write rules in the .htaccess take effect?

查看:27
本文介绍了是否需要重启apache才能使.htaccess中的re-write规则生效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的 .htaccess 文件推送到生产服务器,但它们不起作用.下一步是重启,还是我应该检查其他东西.

I have pushed my .htaccess files to the production severs, but they don't work. Would a restart be the next step, or should I check something else.

推荐答案

对 .htaccess 的更改不需要重新启动.其他地方出了问题.

A restart is not required for changes to .htaccess. Something else is wrong.

确保您的 .htaccess 包含声明

Make sure your .htaccess includes the statement

重写引擎开启

这是必需的,即使它也存在于 httpd.conf 中.还要检查 httpd 进程是否可以读取 .htaccess.
检查 error_log - 它会告诉您 .htaccess 中的任何错误如果它正在被使用.在 .htaccess 中故意放置一个语法错误是一个很好的检查,以确保文件正在被使用——你应该在同一目录中的任何页面上得到 500 错误.

which is required even if it's also present in httpd.conf. Also check that .htaccess is readable by the httpd process.
Check the error_log - it will tell you of any errors in .htaccess if it's being used. Putting an intentional syntax error in .htaccess is a good check to make sure the file is being used -- you should get a 500 error on any page in the same directory.

最后,您可以在 httpd.conf 中使用如下命令启用重写日志:

Lastly, you can enable a rewrite log using commands like the following in your httpd.conf:

RewriteLog日志/重写日志"

RewriteLog "logs/rewritelog"

RewriteLogLevel 7

RewriteLogLevel 7

由此生成的日志文件将为您提供有关哪些重写规则匹配以及它们是如何处理的详细信息.

The log file thus generated will give you the gory detail of which rewrite rules matched and how they were handled.

这篇关于是否需要重启apache才能使.htaccess中的re-write规则生效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆