doucan1996 2016-12-17 15:30
浏览 57
已采纳

Wordpress管理页面.htaccess例外

I have a website made with wordpress (it's a multilingual site) and I'm modifying the .htaccess file in order to make some redirections. My page now is for example: https://example.es

And I'd like to redirect everything to this page (even if you type example.es/en or www.example.es/en or http://www.example.es/es ... all the variants)

My .htaccess now looks like this:

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

It works but when I try to go to my admin page in Wordpress (https://example.es/wp-admin/) I'm being redirect to https://example.es/es/wp-admin/ or https://example.es/en/wp-admin/.

Does anybody know how can I make an exception for this page? I don't want to be redirect when the site is wp-admin, it should be like this: https://example.es/wp-admin/

  • 写回答

1条回答 默认 最新

  • dongtuo5262 2016-12-17 15:42
    关注

    Try adding RewriteCond %{REQUEST_URI} !wp-admin before RewriteEngine on.

    If it doesn't works follow the link below; put RewriteCond %{REQUEST_URI} !wp-adminbefore # BEGIN Wordpress

    Look here: Redirect Visitors to new url but exclude images and admin

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?