【问题标题】:Not redirecting the subdomain using .htaccess不使用 .htaccess 重定向子域
【发布时间】:2012-07-24 13:04:45
【问题描述】:

我有一个使用 wordpress 的网站,我通常登录为:mydomain.com/wp-admin。我希望它在子域上。 我尝试使用以下重写 url 创建子域:

RewriteCond %{HTTP_HOST} ^wp-admin
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteRule ^(.*)$ wp-admin/$1 [L]

但是当我试图到达http://wp-admin.mydomain.com/ 时,会出现一个奇怪的页面,显示一条错误消息:

If you feel you have reached this page in error, please contact the web site owner:

并且网址更改为:

http://wp-admin.mydomain.com/cgi-sys/defaultwebpage.cgi

请帮助我如何才能创建子域。

【问题讨论】:

  • 你能在那个“奇怪的页面”上再详细说明五点吗?服务器错误日志是否提供有关问题的更多详细信息?

标签: apache .htaccess url-rewriting subdomain


【解决方案1】:

您可以尝试提供绝对路径,并强制执行内部重定向(又名pass-through)。

RewriteRule ^(.*)$ /wp-admin/$1 [PT,L]
                   ^             ^^

【讨论】:

    猜你喜欢
    • 2017-08-24
    • 2011-02-02
    • 1970-01-01
    • 2013-04-23
    • 2014-08-19
    • 2013-08-10
    • 2023-03-09
    • 1970-01-01
    相关资源
    最近更新 更多