2012-01-02 105 views
1

我試圖重定向所有具有「/ blog /?」的請求到 「?/?」 並使用我的.htaccess中的以下內容:RedirectMatch/blog /?(something)to /?(something)

RedirectMatch 302 /blog/?(.*) http://www.example.com/?$1 

但是當我檢查,

/blog/?p=28 -> www.example.com/? 

所以剩下被截斷。

p/s /我不想重定向/博客/(something)to example.com/(something)!

p/p/s /我安裝了wordpress,如果這可能很重要。而我需要做這樣的東西,因爲我改變了我的WordPress的文件夾根目錄和使用/博客/顯示最近的職位

回答

0

使用此代碼在您的.htaccess實現的是:

Options +FollowSymLinks -MultiViews 
RewriteEngine on 

RewriteCond %{QUERY_STRING} !^$ 
RewriteRule ^blog/?$/[R=301,L,QSA] 
+0

,完美的工作。謝謝! – Denis 2012-01-02 11:04:44

+0

「QSA」是什麼意思? (L - 最後一條規則) – Denis 2012-01-02 11:07:41

+0

QSA - 查詢字符串追加,R - 重定向,L - 最後。請檢查這個Apache手冊:http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html所有的標誌。 – anubhava 2012-01-02 11:09:43

0

試試這個代碼.htacess

Options +FollowSymLinks 

RewriteEngine On 

#RewriteBase/





RewriteRule ^ProductView-(.*).html product.php?page=$1 



RewriteRule ^Home.html index.php 

把你的文件名,這樣,改變enter code here

相關問題