RewriteCond%{REQUEST_FILENAME}!-f和RewriteCond%{REQUEST_FILENAME}!-d无法正常工作

时间:2015-02-25 11:09:14

标签: php .htaccess mod-rewrite errordocument

我的.htaccess文件包含以下代码

Options +FollowSymlinks
RewriteEngine On

#php_flag display_errors on

# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript


# Or, compress certain file types by extension:
#<files *.html>
#SetOutputFilter DEFLATE
#</files>



#RewriteCond %{REMOTE_HOST} !^12\.188\.175\.226
#RewriteCond %{REQUEST_URI} !/maintenance\.html$
#RewriteRule (.*).html$ /maintenance\.html [R=302,L]

#RewriteCond %{REMOTE_HOST} !^12\.188\.175\.226
#RewriteCond %{REQUEST_URI} !/maintenance\.html$
#RewriteRule ^$ /maintenance\.html [R=302,L]

RewriteCond %{HTTP_HOST} ^(.*)find-junkyards.com [or]
RewriteCond %{HTTP_HOST} ^(.*)findjunkyards.net [or]
RewriteCond %{HTTP_HOST} ^junkyardsnearme.com
RewriteRule (.*) http://www.junkyardsnearme.com/$1 [R=301,L]

#RewriteRule (.*) http://www.junkyardsnearme.com/$1 [R=301,L]

#RewriteRule (.*) http://www.junkyardsnearme.com/$1 [R=301,L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php?_req=/$1&%{QUERY_STRING} [L]
RewriteRule ^(.*)$ index.php/$1 [L]


#ErrorDocument 404 http://dev.junkyardsnearme.com/admin/accounts/error404 

这允许重定向我,如果我把正确的网址,但它没有重定向到index.php,如果网址不正确,而是它给我一个默认的404错误。

如果我删除以下行

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php?_req=/$1&%{QUERY_STRING} [L]
RewriteRule ^(.*)$ index.php/$1 [L]

它不允许我浏览网站流程。我也试过了

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ index.php?_req=/$1&%{QUERY_STRING} [L]
RewriteRule ^(.*)$ index.php/$1 [L]

但它对我不起作用。

任何想法为什么这不起作用请快速回答这将是很大的帮助。

提前感谢。

0 个答案:

没有答案