I’ve purchased a new domain (let’s call this domain1.com) and I’d like to use my existing hosting package (let’s call this domain0.com) to host the website (powered by WordPress) – I can re-direct domain1.com to domain0.com/domain1 or domain1.domain0.com.
Is it possible, using .htaccess to do this? Bear in mind that this will be WordPress-based and so there’ll be some extra .htaccess action to get ‘pretty permalinks’ – will this complicate things even further?
To clarify:
- user enters http://www.domain1.com
- gets sent to http://www.domain0.com/domain1/
- htaccess magic makes it look like they are on http://www.domain1.com
What you’re asking is not possible using mod_rewrite only.
Please understand that Apache doesn’t do internal redirect if HOSTNAME is changing in the target of a RewriteRule. In that case it has to be an external redirect using
Rflag. And if there is an external redirect then domain name of URL in the browser will change tohttp://www.domain0.com.One possible workaround that you can use is to set the DOCUMENT_ROOT for
www.domain1.comtodomain0_DOCUMENTROOT/domain1.