I have two domain names: themaindomain and thealias. Wordpress is located under themaindomain.
I was wondering if it is possible to change the urls to posts and pages when there is a request from thealias To make clear: When there is a request from themaindomain, the server returns a page with some links like themaindomain/post1, themaindomain/page1. When there is a request from thealias, the server should return a page with some other links like thealias/post1, thealias/page1. So the two domains point to the same blog, but depending on the request url it changes the links.
Is this possible and if it is, how?
Thanks a lot...
I have two domain names: themaindomain and thealias. Wordpress is located under themaindomain.
I was wondering if it is possible to change the urls to posts and pages when there is a request from thealias To make clear: When there is a request from themaindomain, the server returns a page with some links like themaindomain/post1, themaindomain/page1. When there is a request from thealias, the server should return a page with some other links like thealias/post1, thealias/page1. So the two domains point to the same blog, but depending on the request url it changes the links.
Is this possible and if it is, how?
Thanks a lot...
Share Improve this question asked Jul 18, 2012 at 17:51 TiesTies 2032 silver badges7 bronze badges1 Answer
Reset to default 2You can use the the WP_HOME
directive in your wp-config.php
. Just set it dynamically based on $_SERVER['HTTP_HOST']
like the example in the codex.
<?php
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
You might also want to define WP_SITEURL
in the same way. I do something like the above for the wp-content url on one of my sites:
<?php
define('WP_CONTENT_URL', '//' . $_SERVER['HTTP_HOST'] . '/content');
All that said, the SEO in me is screaming that this is a terrible idea -- duplicate content and such. Much better to have a single site and redirect the alias to the canonical site.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745598665a4635270.html
评论列表(0条)