2014-10-08 17 views
0

我想添加一個get參數到我的wprdpress網站上的每個網址,除了索引頁面。添加變量到網址throung htaccess文件

例如,

考慮網站的域名爲www.example.com

如果www.example.com被擊中總比沒有要發生

但如果我打www.example.com/events比GET參數即。 「家」被附加到它。最終的URL應如下: www.example.com/events/?home

我想使用此參數進行進一步處理。

我目前.htaccess文件包含以下

<IfModule mod_rewrite.c> 

RewriteEngine On 

RewriteBase/

RewriteRule ^index\.php$ - [L] 

RewriteCond %{QUERY_STRING} !lp-variation-id 

RewriteRule ^go/([^/]*)? /wp-content/plugins/landing-pages/modules/module.redirect-ab-testing.php?permalink_name=$1 [QSA,L] 

RewriteRule ^landing-page=([^/]*)? /wp-content/plugins/landing-pages/modules/module.redirect-ab-testing.php?permalink_name=$1 [QSA,L] 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule . /index.php [L] 


</IfModule> 

而我會在WordPress的項目。

回答

0

試試這個:

RewriteCond !^/$ 
RewriteRule ^/(.*)$ /$1?home 

根據您的託管環境中的URL可能會或可能不會以斜線開頭,那麼你可能需要從重寫規則中刪除。

+0

我試過了,但沒有奏效。我在上面的問題中添加了htaccess文件的內容。 – 2014-10-11 05:28:44