我是一个新手.htaccess和正则表达式。我有一个脚本可以在本地运行,但是当我将它上传到活动服务器时,会导致无限循环。我怎样才能解决这个问题?在网站上,如果您未经身份验证加载http://example.com
,则会将您带到登录表单的http://example.com/auth/
,否则会显示http:///example.com/index.php
的内容。它在本地工作正常,但是当我在活动服务器上传时,它找不到auth.php
,因此它重定向到索引页面,并且由于用户未通过身份验证,因此发送到auth.php
因此发生无限循环。请帮忙。谢谢。.htaccess导致在服务器上的无限循环,但在本地主机上工作
这是我的文件
Options -Indexes
Options -MultiViews
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
# remove php extensions (only for GET method)
RewriteCond %{THE_REQUEST} ^GET\ /(.+)\.php(?:\?|\s) [NC]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule^%1/? [L,R=301]
# don't touch other existing files/folders
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule^- [L]
# force trailing slash
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f
RewriteRule ^(.+)$ $1/ [L,R=301]
# rewrite extensionless php files
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.+)/$ $1.php [L]
#rewrite path to file eg http://example.com/auth/recover to http://example.com/auth.php?a=recover
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([^/]+)/([^/]+)/?$ $1.php?a=$2 [QSA,L]
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ $1.php?a=$2&id=$3 [QSA,L]
# finally, if not found
RewriteRule^index.php [L]
</IfModule>
没有评论???真???非常感谢 – sammyukavi