开发者

How to run Wordpress admin on a different subdomain?

I have the requirement of running the Wordpress admin over https. We use a cdn to deliver cached content for the site but the cdn cannot accept secure traffic (only one SSL cert per IP allowed, and we run several sites off it). I cannot control redirects for httpS://www.mysite.com/.

I would like to have:

http://www.mysite.com/blog/
httpS://secure.mysite.com/blog/wp-admin/
httpS://secure.mysite.com/blog/wp-login.php

I have tried rewriting the urls as suggested in the article http://codex.wordpress.org/Administration_Over_SSL#Virtual_Hosts.

Hypothetically, you could use a host with a different name, such as wpadmin.mysite.com

Unfortuna开发者_JAVA百科tely trying this as suggested still sends me to httpS://www.mysite.com/blog/login.php.

# No matter what it redirects to the wrong subdomain for login.php
http://www.mysite.com/blog/wp-admin/
-> httpS://secure.mysite.com/blog/wp-admin/
-> httpS://www.mysite.com/blog/wp-login.php.

Also when directly going to the css files still link to the wrong url (.)

The simple solution would have been to run the blog off http://blog.mysite.com/blog/. Unfortunately this has been tried and was decided against for SEO reasons.

Is there anyway Wordpress can do this?


Have you looked into this thread? It is a mod on the WordPress HTTPS plugin.


Not too sure if you have seen this article but it's pretty comprehensive when it comes to Wordpress Admin over SSL. Scroll down to the part about Virtual Hosts, and there is information there about setting up the wp-admin as a subdomain.

http://codex.wordpress.org/Administration_Over_SSL


If you're using Apache to serve over SSL, look into mod_proxy.

Using it you can transparently redirect all requests from https://secure.mysite.com/blog/ to http://www.mysite.com/blog/.


The plugin http://wordpress.org/extend/plugins/admin-ssl-secure-admin/ is exactly what I was after.

Unfortunately its broken on newer Wordpress versions :(


To enable admin access for http://blog.example.com through https://ssl.example.com/wp-admins/blog/wp-login.php with pure Apache config so you have no dependence on Wordpress plugins and updates you may want to...

...use mod_proxy on an HTTPS apache virtual host to forward traffic, ensure ProxyPreserveHost is Off so that host names in the proxy statements are sent through to the wordpress server. Then mod_substitute is used (make sure to turn it on) to fix the broken links coming back from wordpress.

<Location /wp-admins/blog/>

  AddOutputFilterByType SUBSTITUTE text/html
  AddOutputFilterByType SUBSTITUTE text/css
  AddOutputFilterByType SUBSTITUTE application/javascript
  AddOutputFilterByType SUBSTITUTE application/json
  Substitute "s|http://blog.example.com|https://ssl.example.com/wp-admins/blog|i"
  Substitute "s|blog.example.com\\\/|blog.example.com\\/wp-admins\\/blog\\/|i"
  Substitute "s|'/wp-admin|'/wp-admins/blog/wp-admin|i"
  Substitute "s|\"/wp-admin|\"/wp-admins/blog/wp-admin|i"
  Substitute "s|'/wp-includes|'/wp-admins/blog/wp-includes|i"
  ProxyPassReverseCookiePath / /wp-admins/blog/

</Location>

ProxyPass /wp-admins/blog/ http://blog.example.com/
ProxyPassReverse /wp-admins/blog/ http://blog.example.com/

For the reverse proxy to work, you need to specify the internal IP of the server hosting blog.example.com. This solution ensures this will work even if the upstream server (10.0.0.4) has several name-based virtual hosts.

10.0.0.4 blog.example.com

For more details, see:

http://tec.libertar.se/how-to-host-wordpress-admin-on-a-seperate-domain-and-subfolder/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜