Change URLs depending on alias

I have two domain names: themaindomain and thealias.Wordpress is located under themaindomain. I was wondering if it is

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 badges
Add a comment  | 

1 Answer 1

Reset to default 2

You 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

相关推荐

  • Change URLs depending on alias

    I have two domain names: themaindomain and thealias.Wordpress is located under themaindomain. I was wondering if it is

    14小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信