How can I use .htaccess to rewrite a a page on a subdomain to a page on the parent? (E.g. people visiting mysite.com/landingpage will see the content from dev.mysite.com/landingpage)?

Ive been working to redesign a WordPress site, using a dev.mysite.com subdomain. The site isn't ready to replace the live WP site yet (mysite.com) but I need to map one of the pages to the old domain and make it public. Since all the work (template,database,etc) is on the subdomain, I can't just import the page to the old domain, so I seemingly need to use mod_rewrite, which is way beyond my skill level. Also, since its two different WP Installations (not multisite), would I use the domain .htaccess file or the subdomain .htaccess file?


2 Answers 2


If you use the main domain .htaccess file when people go onto the page you want to display on the sub domain it will change the url link to dev.mysite.com I am not sure if that is the best approach but if you want to do it that way you would have to use the main domains .htaccess to redirect to the subdomain.

Another option could be export the page's data with a WordPress exporting plugin. A search on the website led me to this one which may be of some use. https://en-gb.wordpress.org/plugins/wp-exporter/

  • As I tried to explain, because its two separate WordPress installations (different versions, themes, functions.php, plugins, and more) I can't just export the page to the parent domain). Also, Im not trying to redirect to a different page, but rewrite the url. And the goal is to make dev.mysite.com/page appear when someone visits mysite.com/page (keeping the url that the visitor used). Dec 10, 2016 at 11:18

You seem to be speaking of URL masking. Please refer here and here for examples.

A visitor to example.com/mypage can be shown example.net/mypage while seeing example.com/mypage in the address bar. Not sure how you'd handle the links from example.net/mypage back to the main site instead of the development site, but that wasn't part of the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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