.htaccess 重写模式不起作用

发布于 2024-09-27 18:16:13 字数 175 浏览 0 评论 0原文

.htaccess 中的重写脚本

RewriteEngine on

RewriteRule ^index/page/(.*)$ index.php?page=$1

它适用于本地计算机。但在服务器中它不起作用。有人可以帮助我吗?

rewrite script in .htaccess

RewriteEngine on

RewriteRule ^index/page/(.*)$ index.php?page=$1

It works in local machine. but in server it does not work. can any body help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

很快妥协 2024-10-04 18:16:14

您是否已验证您的服务器上是否已加载重写模块?如果服务器正在运行 apache,您应该能够通过

apache2ctl -t -D DUMP_MODULES

在响应中查找 rewrite_module 来验证这一点。 (注意:您可能需要apachectl,具体取决于您使用的计算机。)

如果未加载,您可能需要更改服务器配置。这是可行的(同样,取决于所使用的 apache 版本),只需执行以下步骤

a2enmod rewrite

或确保您的 httpd.conf 文件包含

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

或确保存在符号链接在 rewrite.load 文件 /etc/apache2/mods-enabled/etc/apache2/mods-available 之间。

之后不要忘记重新启动 apache。

Have you verified that the rewrite module is loaded on your server? If the server is running apache you should be able to verify this with

apache2ctl -t -D DUMP_MODULES

and looking for the rewrite_module in the response. (NB: You may need apachectl depending on the machine you are using.)

If it is not loaded you might need to change your server configuration. This is doable (again, depending on the version of apache in use) with a step like

a2enmod rewrite

or ensuring your httpd.conf file contains

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

or by ensuring there's a symbolic link between the rewrite.load file /etc/apache2/mods-enabled and /etc/apache2/mods-available.

Don't forget to restart apache afterwards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文