We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23183
    • 102 Posts
    Ive been running a site for a couple of months on a .co.uk domain, Ive now acquired to .com domain and want to set this as the primary address for the site, with re-direct formthe .co.uk. I want to establish how to do this seamlessly and make sure i dont mess anything up, especially with Google smiley

    Ive changed the nameserver of the .com domain to poin to my host.

    They are going to set it as the Primary address

    I want to clear up what other things I will need to do. Will there be one .htaccess file still or one for each domain?

    What will I need to change in the htaccess and when I set a re-direct will it redirect all pages to the equivalent .com domain or just the hompage?

    In modx, I will have to change the address in the config? Also any reference to the old domain I have in the code.

    What other changes will I have to make?

    Thanks
      • 25663 MODX Staff
      • 12,272 Posts
      Just like moving a site to a new server, you most likely need to re-run the installer in upgrade mode to reset your configuration file and paths as appropriate. If you’re not running the latest version of MODx, you should definitely take the time to upgrade as well.

      http://svn.modxcms.com/docs/display/MODx096/Moving+Site
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 23183
        • 102 Posts
        Thanks for that Ryan,

        I have updated the .htacces to the .com domain, however all of my images etc it is still looking for them on the .co.uk domain.

        I cant remember when the congiuration is for this? all the path names should be the same other than .com domain
          • 23183
          • 102 Posts
          Ok, Im getting there. I did the upgrade and that seems to have sorted out the links.

          Can anyone help me out with setting up a 301 redirect?

          I have added this to my .htaccess:
          RewriteCond %{HTTP_HOST} ^myolddomain.co.uk$ [OR]
          RewriteCond %{HTTP_HOST} ^www.myolddomain.co.uk$
          RewriteRule ^(.*)$ "http\:\/\/www\.mynewdomain\.com\/$1" [R=301,L]


          Which is not working with friendly URLS its adding ’index.php?q=’ to the re-directed URL. Is there a way I can strip this form the URL.

          example

          www.myolddomain.co.uk/folder1

          redirects to:

          www.mynewdomain.co/index.php?q=folder1

          EDIT: I solved this by moving the redirect to above the modx rewrite code smiley