2011-10-31 124 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

我实际上是自己解决了这个问题,而且我远远没有想到这个问题,忘记了先查看更明显的事情。似乎我使用的缓存插件是停止重定向,它花了我三天才终于明白缓存会阻止重定向。