2016-02-09 121 views
2

我有一個網站在緩存中,無法刪除。如果我在鏈接前使用nocache=1,它工作正常。我想將鏈接http://www.link.com重定向到http://www.link.com/?nocache=1使用.htaccess重定向頁面

我一直在使用

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
Redirect 301/http://www.link.com/?nocache=1 
</IfModule> 
# END WordPress 

嘗試,但並沒有得到它的權利。請幫忙。

回答

0

你可以嘗試添加nocache=1 WordPress的調度之前的所有要求:

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

RewriteRule ^(.*)$ /$1?nocache=1 [QSA] 

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 
+0

仍然沒有工作。 – Ashish

0

這一規則替換您Redirect 301規則:

RewriteCond %{QUERY_STRING} !(^|&)nocache=1(&|$) [NC] 
RewriteRule ^(.*)$ /$1?nocache=1 [L,QSA,R=302] 

,並確保它是僅低於RewriteEngine On

+0

仍然沒有工作。 – Ashish

+0

該評論如何幫助你? – anubhava

+0

需要所有這些問題的答案。 Q0。你在瀏覽器中輸入了什麼網址? Q1。這是唯一的.htaccess還是你有另一個? Q2。這是這個.htaccess中唯一的代碼嗎?如果您有其他代碼,請將其張貼在問題中? Q3。以上.htaccess的完整路徑是什麼? – anubhava