Not redirecting the subdomain using .htaccess

落爺英雄遲暮 提交于 2019-12-12 04:14:02

问题


I have site which uses wordpress and I usually login as : mydomain.com/wp-admin . I want it to be on the subdomain . I have tried to create a subdomain by using the following rewrite url :

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

But when I am trying to reachhttp://wp-admin.mydomain.com/ a weired page comes out saying an error message :

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

And the url changes to :

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

Please help how could I be able to create a subdomain .


回答1:


You could try to give an absolute path, and to enforce an internal redirect (aka. pass-through).

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


来源:https://stackoverflow.com/questions/11631500/not-redirecting-the-subdomain-using-htaccess

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!