Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have two domain names: and Wordpress is located under

I was wondering if it is possible to change the urls to posts and pages when there is a request from To make clear: When there is a request from, the server returns a page with some links like, When there is a request from, the server should return a page with some other links like, 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

closed as off topic by Chris_O, Brian Fegter, EAMann Jul 18 '12 at 20:12

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

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.

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:

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.

share|improve this answer
About that SEO, you're right, I guess. I haven't thought that much about it. Thank you anyway. –  TV productions Jul 18 '12 at 21:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.