Redirect a domain to another file domain keeping web browser URL (htaccess)
Situation:
You have a site (eg. www.mysite.com) and a page of this site dedicated to photography (eg. www.mysite.com/photography.html) . For some reason you buy another domain (eg. www.photosite.com) and want to render your photography.html page below this new domain.
Solution:
Use a htaccess file running Apache server to solve that. How?
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^$ photography.html [L]
RewriteRule ^(.*)$ http://www.photosite.com/$1 [P]
And upload it to you new domain renaming the name to .htaccess .
Explanation:
- First rule will redirect www.photosite.com to www.photosite.com/photography.html
- Second one will "render" every www.mysite.com/any-site-page.html under domain www.photosite.com, and keeping this url domain even navigating between different pages (that's why there's a [P], standing for Proxy).
Hope you you find it useful.