We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30912
    • 463 Posts
    We have a site, which within it has a 2nd site (yes i know i shouldve used revolution - but that option wasnt available to me at the moment)

    Basically if a visitor visits www.domain1.co.uk they get sent to id #2. If they visit www.domain2.com they get sent to id #78

    Has anyone got an idea on how to acheive this?

    The domain has no relevance, so it doesnt matter if you go into the 2nd sites content from domain 1, they just need to have differing landing pages.

    cheers
      • 33968
      • 863 Posts
      So domain1 is your main site, and domain2 should just go to one landing page within your site? Both domains currently send the visitor to the site root?

      My first thought would be to add a line in your .htaccess file to rewrite ’domain2’ to page 78. Whether you stay on domain2 or send the visitor to domain1 is up to you, but this is how I would do it.
      Something like this:
      RewriteCond %{HTTP_HOST} ^www\.domain2\.com [NC]
      RewriteRule (.*) http://www.domain1.co.uk/index.php?id=78$1 [R=301,L]
      

      I think that would avoid duplicate content issues (for SEO). If you choose to keep the page on ’domain2’, be sure to add the canonical meta tag to your template and point it to the ’domain1’ version of the page.
        • 30912
        • 463 Posts
        Thanks lucas, makes sense i’ll let you know how i get on.
          • 30912
          • 463 Posts
          Hi lucas,

          that certainly did the trick, is there any way that i could retain the domain nam ein the address bar via the htaccess, i know this is technically classed as spoofing, but they are the same site and company.

          also, how would i rewrite the alias to be friendly?

          Sorry im a htacess simpleton

          Cheers
            • 33968
            • 863 Posts
            I’m only one level up from .htaccess simpleton smiley

            To rewrite to the ’friendly url’ version you can just do this:
            RewriteRule (.*) http://www.domain1.co.uk/page-name-here$1 [R=301,L]
            

            But if the page name changes, you will need to update the .htaccess file. I’m not sure if there is a way to do it dynamically (ie. redirecting to the doc id but keeping the url alias).

            I think it’s possible to keep that page on the new domain but I would need to do a little trial and error before figuring it out. Don’t have a spare domain at the moment I’m afraid! Maybe speak to your web host as they might be able to help you configure it.
              • 30912
              • 463 Posts
              Well, its pointing but its rewriting to the true domain, which works for now but its not something we can have in the long run.

              I had a word with our host, they suggested that we set up a 2nd virtual host for the domain we want to keep in the url and modify the vhost.conf file to look at the root of the other installation.

              thats fine, its all been modified but im now in a position of not knowing how to modify the htaccess to respect the domains accordingly. in theory this should all just work out of the box, however the chances are thats not the case.

              one of these ddays i will actually learn more about the htacess as well.

              Thanks