【问题标题】:WordPress - redirect all pages to other domain and exception homepage and wp-adminWordPress - 将所有页面重定向到其他域和异常主页和 wp-admin
【发布时间】:2014-11-08 21:32:23
【问题描述】:

我需要 WordPress 重定向方面的帮助。我认为,最简单的方法是使用 htaccess 文件。 我希望 301 将所有页面从我的网站 www.domain.com 重定向到子域 web.domain.com,但我希望主页 www.domain.com 和 www.domain.com/wp-admin/ 中的 wordpress 管理员有例外。 .. 和 www.domain.com/wp-login.php

我有基本的 wordpress htaccess 设置:

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

【问题讨论】:

    标签: wordpress .htaccess redirect


    【解决方案1】:

    感谢您的帮助 - 我发现,我需要两个 wp 管理员,所以我进行了以下设置:

    RewriteEngine on    
    RewriteCond %{REQUEST_URI} !/$    
    RewriteCond %{REQUEST_URI} !/wpinstall(/.*)$    
    RewriteRule (.*) http://web.domain.cz/$1 [R=301,QSA]
    

    然后我将 wp 安装到子文件夹 wpinstall

    【讨论】:

      【解决方案2】:

      你可以这样做:

      <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteBase /
      
      RewriteRule !^(wp-admin(/.*)?|wp-login\.php)?$ http://web.domain.com%{REQUEST_URI} [L,NC,NE,R=301]
      
      RewriteRule ^index\.php$ - [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
      </IfModule>
      

      【讨论】:

        猜你喜欢
        • 2018-07-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-06-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-07-25
        相关资源
        最近更新 更多