【问题标题】:htaccess working good on localhost, giving errors on 127.0.0.1htaccess 在本地主机上运行良好,在 127.0.0.1 上出现错误
【发布时间】:2013-04-03 15:09:45
【问题描述】:

当我在localhost 上查看我的网站时,它运行良好。当我尝试在我的网络 ip (192.68.x.x) or 127.0.0.1 上打开它时,我收到错误 500 内部服务器错误。我检查了 apache 日志,这是错误:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

我在 so 上读到了同样的错误,我得到了一些应该可以工作的 htaccess 示例,尝试了所有但我只是不断收到消息,在某些情况下 http://localhost 也停止工作。我的 htaccess 将所有内容重定向回 index.php,从我开始我的网站类。

这是我的 htaccess :

RewriteEngine on
RewriteBase /
RewriteCond  %{REQUEST_FILENAME} !-f
RewriteCond  %{REQUEST_FILENAME} !-d
RewriteRule  ^(.*)$ index.php?param=$1 [QSA,L]

谁能指出我正确的方向?谢谢!

【问题讨论】:

标签: php apache .htaccess


【解决方案1】:

1/ 检查您的主机文件中是否有此规则:127.0.0.1 localhost

2/ 检查 Apache rewrite_module 是否被激活。

3/ 确保您的项目位于子文件夹中(我们以mysite/ 为例)。

4/ 设置您的根 htaccess (/.htaccess):

Options -Indexes +FollowSymlinks
RewriteEngine On
RewriteBase /

5/ 设置你的项目 htaccess (/mysite/.htaccess) :

RewriteEngine on
RewriteBase /mysite/
RewriteCond  %{REQUEST_FILENAME} !-f
RewriteCond  %{REQUEST_FILENAME} !-d
RewriteRule  ^(.*)$ index.php?param=$1 [QSA,L]

【讨论】:

    最近更新 更多