我的公司網站存在一些問題。我的同事離開了.htaccess
文件_control
目錄裏面是這樣的:Apache 404網址無效
# Virtual site directory
#
# This script lets us make use of default
# versions of files used in a typical site.
# When a request on the site is made for a file
# that doesn't exist, instead of a 404 we rewrite
# the path to /_control/site/
#
# Any file in the directory this script is in will
# take precedence over this script, so this script
# only comes into play if the file does not exist.
# First, set up URL rewriting
Options +FollowSymLinks
RewriteEngine On
# Add trailing slash for directories
# TODO: fix if site not in root dir (e.g. DEV server)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !.+\.(php|js|css|gif|jpg|jpeg|png)$ [NC]
RewriteCond %{REQUEST_URI} !.*/$
RewriteRule ^(.*)$ /$1/ [L,R=301]
# This Apache mod_rewrite rule checks to see
# if the requested file exists, if it doesn't
# then we rewrite to the respective site location.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^.*/_control/(admin|common).*$
RewriteCond %{REQUEST_FILENAME} !^.*/_control/site/.*$
RewriteRule ^(.*)$ site/$1 [L]
我的應用程序的結構是這樣的:
一切都在一個星期前工作正常,但對我們的mysite的。 com/admin和404頁面開始重定向到託管公司的網站。 DaveG已經在這裏回答了第一部分問題:https://stackoverflow.com/a/26013322/1933380並且我能夠獲得虛擬目錄的工作。我仍然遇到404頁面的問題。我錯過了什麼或者犯了錯誤嗎?
我沒有在您的.htaccess中看到任何'ErrorDocument 404'行。另外你的規則是說任何不存在的文件或目錄都會將它發送到'site/$ 1',所以顯然會影響404的處理。 – anubhava 2014-09-24 11:47:55