【发布时间】:2014-09-24 09:07:51
【问题描述】:
我的公司网站有一些问题。我的同事留下了这样的.htaccess 文件:
# Files in this directory will override the
# controlled equivalent.
# First, set up URL rewriting
Options +FollowSymLinks
RewriteEngine On
# Forbid access to .htaccess files
RewriteRule ^\.htaccess$ - [F]
RewriteRule ^php\.ini$ - [F]
# This Apache mod_rewrite rule checks to see
# if the requested file exists as either a file
# or a directory, if it doesn't then we rewrite
# to the respective controlled location (unless
# we're already there!).
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^.*/_control/.*$
RewriteRule ^(.*)$ _control/$1 [L]
一切正常,但大约一周前,我们的 mysite.com/admin 和 404 页面开始重定向到托管公司的网站。我进一步调查,似乎问题出在最后四行。根据 Greg 在这里的回答:https://stackoverflow.com/a/697980/1933380 我将其更改为:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^.*/_control/.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ _control/$1 [L]
但它也不起作用。文件夹结构如下:
我是否遗漏了什么或犯了错误?
【问题讨论】: