【问题标题】:Shared Domain multidomain trouble共享域多域麻烦
【发布时间】:2013-07-16 16:04:11
【问题描述】:

我在一个 ftp 中托管了以下配置:

www/domain2

www 对应于另一个域 (domain1),当我尝试访问 domain2 中 wordpress 中的帖子时,url 如下所示:

domain2.com 

如果我点击帖子或文章:

domain1.com/domain2.com/postexample

如何配置 mod_rewrite 以使 url 始终像 www.domain2.com/postexamle 并且从不显示 domain1?

我放.htaccess 的路径是www/domain2/.htaccess 对吗?

【问题讨论】:

    标签: apache .htaccess mod-rewrite ftp hosting


    【解决方案1】:

    将您的 .htaccess 移动到 /www 并使用以下内容

    RewriteEngine on
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} ^(www\.)?domain2.com$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-d # not a dir
    RewriteCond %{REQUEST_FILENAME} !-f # not a file
    RewriteRule ^(.*)$ /domain2/$1 [L]
    

    但是,您需要确保您的文章链接中不包含domain2。因此,它们可以是 http://www.domain2.com/some-domain-2-file.php(绝对值)或只是 some-domain-2-folder/file.php(相对值)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-04
      • 2011-10-18
      • 2015-01-27
      • 2016-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-01
      相关资源
      最近更新 更多