Php 循环重定向-.htaccess问题
我正在尝试解决本地主机上的问题 我有一个使用以下.htaccess文件的脚本Php 循环重定向-.htaccess问题,php,.htaccess,mod-rewrite,redirect,rewrite,Php,.htaccess,Mod Rewrite,Redirect,Rewrite,我正在尝试解决本地主机上的问题 我有一个使用以下.htaccess文件的脚本 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /agg/ RewriteCond %{HTTP_HOST} ^localhost RewriteRule ^(.*)$ http://localhost/agg/$1 [R=permanent,L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQ
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /agg/
RewriteCond %{HTTP_HOST} ^localhost
RewriteRule ^(.*)$ http://localhost/agg/$1 [R=permanent,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agg/index.php [L]
</IfModule>
重新启动发动机
重写基/agg/
重写cond%{HTTP_HOST}^localhost
重写规则^(.*)$http://localhost/agg/$1[R=永久性,L]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/agg/index.php[L]
“agg”是本地主机上存储文件的文件夹
(完整路径:C:\wamp\www\agg)
当我尝试访问时,它会给我“此网页有重定向循环”错误
apache rewrite_模块已打开,php版本为5.4.12
还有一个名为“config.php”的文件,其中包含以下代码:
<?php
$siteurl = "http://localhost";
//.... etc
?>
任何帮助都将不胜感激。您的第一条规则是导致此循环的罪魁祸首。将此代码保存在
/agg/.htaccess
中:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /agg/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
重新启动发动机
重写基/agg/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。index.php[L]