domain redirect to a page and rewrite url of landing to keep orgin domain

this it might be easy but I’m not sure how to achieve it (nor if it’s actually possible..)

I’ve made a page in wordpress, with a custom template design, and not linked with the rest of the website, so it’s a landing page which actually has nothing to spare with the base website.

Read More

I’ve bought a domain and redirected with a 301 to this page (to pass seo from that page as well).

the problem is that now I’d like to have the url of that page rewritten in order to be the same of the one I’ve bought, so when landing in that page, viewers won’t notice that they are in another domain.

basically I want that a domain like this

my-new-domain.com

which redirects to this page (I’ve done this)

maindomain.com/landing-page/

and once you’re there, the url displayed is:

my-new-domain.com

the page is wordpress, so I need it to keep passing the variables while the url is rewritten.
but I don’t need it to handle sub-pages, as the page is a single landing page.

can I do this with an htaccess rule? and if yes, could you please tell me how this rule should ne written?

Thanx to anyone who’ll help!
Andrea

Related posts

Leave a Reply

1 comment

  1. You could use mod_rewrite for this

    RewriteCond %{HTTP_HOST} my-new-domein.com [NC]
    RewriteRule ^ /landing-page [L]
    

    The first rule is the condition, so if the domein (http host) matches your domein the second line get executed, [NC] means no case, so my-new-domain.com and MY-NEW-DOMAIN.com both work

    The second rule has 3 parts

    ^
    

    as another condition (always matches)

    /landing-page
    

    that’s the page which is passed to wordpress

    [L]
    

    means this is the last rule to be executed, handy when multiple rewrite rules at in the .htacess

    Edit:

    In addition, if you want mydomain.com/landing-page to show it’s content but with my-new-domain.com in the url bar use the following to redirect to my-new-domain.com

    Redirect 302 /landing-page http://my-new-domain.com