2016-12-17 48 views
1

我有一個網站與wordpress(這是一個多語言網站),我正在修改.htaccess文件,以便做出一些重定向。我的頁面現在是例如:https://example.esWordPress的管理頁面.htaccess例外

我想將所有內容重定向到此頁面(即使您鍵入example.es/en或www.example.es/en或http://www.example.es/es ...所有變體)

我的.htaccess現在看起來是這樣的:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^www.example.es$ [NC] 
RewriteCond %{REQUEST_URI} jh73820h.htm$ [NC] 
RewriteRule .* - [L] 
RewriteCond %{HTTPS} off 
RewriteRule (.*) https://example.es/$1 [R=301,L,QSA] 

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

# END WordPress 

它的工作原理,但是當我嘗試去我的管理頁面中的WordPress(https://example.es/wp-admin/)我被重定向到https://example.es/es/wp-admin/https://example.es/en/wp-admin/

有誰知道我該如何爲此頁面設置例外?我不想在網站是wp-admin時重定向,它應該是這樣的:https://example.es/wp-admin/

回答

2

嘗試在RewriteEngine on之前添加RewriteCond %{REQUEST_URI} !wp-admin

如果不起作用,請點擊下面的鏈接;把RewriteCond %{REQUEST_URI} !wp-admin# BEGIN Wordpress

看吧: Redirect Visitors to new url but exclude images and admin

+0

它適用於第一種方式!非常感謝!我認爲我在這段代碼中有302重定向,我希望他們都是301,我該怎麼辦? – Anna

+0

http://stackoverflow.com/questions/23706217/how-to-change-302-redirect-to-301-redirect-in-htaccess @安娜 – cweitat

+0

該答案的右側有很多相關鏈接,你可以看看這些如果這沒有幫助 – cweitat