2011-10-31 129 views
0

好了,我不知道該如何去甚至約在問這個,但這裏去....htaccess停止php重定向?

我目前已經安裝的WordPress爲我們的網站 - 我試圖做一個簡單的PHP重定向我們的網站進入移動瀏覽器被重定向到我們的移動網站......但是,當我把腳本放入時,沒有任何反應,沒有重定向,站點只是正常工作。

現在我們有3個其他的Wordpress安裝(作爲同一臺服務器上的虛擬主機),我可以在所有其他安裝上獲得重定向工作,而不是我們希望它工作的那個(當然),唯一的眩光差異是htaccess文件。我不是htaccess的主人,所以我唯一的想法是,在htaccess文件中的東西是防止我的PHP重定向,這可能嗎?

或者還有其他可能性,我錯過了嗎?

在此先感謝!

編輯,對不起,我忘了添加htaccess文件!

RewriteEngine On 


# BEGIN W3 Total Cache 
<IfModule mod_setenvif.c> 
SetEnvIfNoCase Accept-Encoding (gzip|deflate) APPEND_EXT=.$1 
</IfModule> 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_URI} \/$ 
RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp- (app|cron|login|register).php|wp-.*\.php|index\.php) [OR] 
RewriteCond %{REQUEST_URI} (wp-comments-popup\.php|wp-links-opml\.php|wp-locations\.php) [NC] 
RewriteCond %{REQUEST_METHOD} !=POST 
RewriteCond %{QUERY_STRING} ="" 
RewriteCond %{HTTP_COOKIE} !(comment_author|wp-postpass|wordpress_\[a-f0-9\]\+|wordpress_logged_in) [NC] 
RewriteCond %{HTTP_USER_AGENT} !(bot|ia_archive|slurp|crawl|spider) [NC] 
RewriteCond /var/www/wordpress/wp-content/w3tc/pgcache/$1/_default_.html%{ENV:APPEND_EXT} -f 
RewriteRule (.*) wp-content/w3tc/pgcache/$1/_default_.html%{ENV:APPEND_EXT} [L] 
</IfModule> 
# END W3 Total Cache 

# Performance Options 
Header unset Pragma 
FileETag None 
Header unset ETag 

# 1 YEAR 
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$"> 
Header set Cache-Control "public" 
Header set Expires "Thu, 18 Apr 2011 20:00:00 GMT" 
Header unset Last-Modified 
</FilesMatch> 

# 2 HOURS 
<FilesMatch "\.(html|htm|xml|txt|xsl)$"> 
Header set Cache-Control "max-age=7200, must-revalidate" 
</FilesMatch> 

# CACHED FOREVER 
# MOD_REWRITE TO RENAME EVERY CHANGE 
<FilesMatch "\.(js|css)$"> 
Header set Cache-Control "public" 
Header set Expires "Thu, 15 Apr 2019 20:00:00 GMT" 
Header unset Last-Modified 
</FilesMatch> 


AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x- javascript 

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !.*.(?:gif|jpg|png|pdf|mp3|avi|mpeg|bmp|mov|ico) 

RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

# protect the htaccess file 
<files .htaccess> 
order allow,deny 
deny from all 
</files> 

# protect wpconfig.php 
<files wp-config.php> 
order allow,deny 
deny from all 
</files> 

# Error Document 
ErrorDocument 403 /error/403/index.html 

# deny directory listings 
Options -Indexes 
+1

如何發佈你的'.htaccess'文件或者我們應該猜測你在做什麼?什麼類型的重定向,以及它失敗的原因? – Jakub

+0

你在說什麼.htaccess文件的差異? (請告訴我們)。你是如何做php重定向的?...也許htaccess可以做到這一點,是的,因爲apache處理你的請求的方式是在尋找某個php文件並處理它之前。 – Alfabravo

+0

這是可能的。我的意思是,你可以在那裏放一個'全部拒絕'或'php_flag引擎關閉'。發佈有問題的htaccess文件,以及您添加到wordpress的代碼,將大大有助於您的問題得到解答。 – derobert

回答

0

我實際上是自己解決了這個問題,而且我遠遠沒有想到這個問題,忘記了先查看更明顯的事情。似乎我使用的緩存插件是停止重定向,它花了我三天才終於明白緩存會阻止重定向。