【问题标题】:redirection from subdomain to subdirectory is not working从子域到子目录的重定向不起作用
【发布时间】:2017-06-09 10:34:30
【问题描述】:

我已将我的 wordpress 博客从子域迁移到子目录。因此,我已将 blog.example.com 实现为 https://www.edgrab.com/blog,除了少数几件事外,一切都运行良好。

1.https://blog.example.com/post-name 未重定向到 https://www.example.com/blog/post-name 并给出内部服务器错误 500,而 blog.example.com 正在成功重定向到 https://www.example.com/blog

我的 .htaccess 文件是

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^blog\.example\.com
RewriteRule ^(.*)$ https://www\.example\.com/blog/$1 [L]

【问题讨论】:

  • 请检查您的 error.log 以获取有关错误的信息。

标签: wordpress apache .htaccess redirect


【解决方案1】:

从子域重定向到 .httaccess 的子目录

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain\.com/subdomains/%1

【讨论】:

    猜你喜欢
    • 2014-04-10
    • 1970-01-01
    • 1970-01-01
    • 2011-06-28
    • 1970-01-01
    • 2023-03-14
    • 2018-10-25
    • 2013-01-29
    • 2017-10-27
    相关资源
    最近更新 更多