【问题标题】:.htaccess redirect domain root not sub-directories.htaccess 重定向域根目录而不是子目录
【发布时间】:2013-09-12 10:30:22
【问题描述】:

在 cPanel 服务器上工作。我需要将帐户的域根目录重定向到一个新的子目录,但不理会其他子目录,其中许多子目录用作同一帐户上其他网站的附加域。

domain1.com 使用 ./public_html/ 并且需要重定向到 public_html/newdir

domain2.com 使用 public_html/subdir

domain2.com 是这种方式的众多设置之一。

试过了,但它不适用于 domain2.com。

RewriteCond %{REQUEST_URI} ^/[/]?$
RewriteRule (.*) /newdir [R=301,L]

谢谢

【问题讨论】:

    标签: .htaccess redirect cpanel


    【解决方案1】:

    我尝试将我的主域重定向到我的博客而不是我的子目录,以下规则对我有用。

     RewriteEngine on
     RewriteCond %{REQUEST_URI} !^/exclude-directory/.*$
     RewriteRule ^(.*)$ http://redirect-to-domain.name/$1 [R=301,L]
    

    !!!!

    【讨论】:

      猜你喜欢
      • 2017-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-11
      • 1970-01-01
      • 2014-05-04
      • 2021-04-04
      • 1970-01-01
      相关资源
      最近更新 更多