We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25197
    • 7 Posts
    I've been using ModX for about 8 years and this is the first time I've ever had to post in this forum. I'm not a developer by any means. I've always been able to look up what problems I'm having, and I've always found an answer!

    I'm stuck now, though.

    I built my site using ModX and it's been working flawlessly. I decided to build a new site and manage it with the same installation of ModX. I'm using Xrouting for this.

    I went ahead and pointed my domain2 to the ModX install directory.. Checked that it was pointing to domain1 and it was.

    I then installed Xrouting.

    Then I created my new context with the following settings:



    Now both domains show a 404 error.

    Then I tried this same thing on another ModX install and it worked. The only difference with this install is I didn't have Friendly URLs on (yet) and I hadn't renamed the ht.acces file.

    I'm thinking it's just my .htaccess file. Since I was running one site originally, I had the rewrite set for just that domain. How do I set rewrites and friendly URLs on my .htaccess file for two different domains running on the same install? Or is there something else I'm doing wrong?
      • 3749
      • 24,544 Posts
      You may need to alter .htaccess, but first, make sure your base href tag (in the head section of every template) has the exclamation point so it won't come from the cache.

      <base href="[[!++site_url]]" />
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 25197
        • 7 Posts
        Quote from: BobRay at Feb 28, 2017, 02:10 PM
        You may need to alter .htaccess, but first, make sure your base href tag (in the head section of every template) has the exclamation point so it won't come from the cache.

        <base href="[[!++site_url]]">

        Thanks for the reply, Bob!

        I've already set the base href tag uncached on my templates. I've cleared the cache manually, and also cleared my browsers cache and I'm still getting a 404.

        Here's what I have in my .htaccess. In my case domain1 is sldgtv.com and domain2 is laredomusicawards.com (the context I created above). Do I need to add anything to my .htaccess other than what I already had when I was running only sldgtv.com?

        RewriteEngine On
        RewriteBase /
        
        RewriteCond %{HTTP_HOST} .
        RewriteCond %{HTTP_HOST} !^sldgtv\.com [NC]
        RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
        RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
        RewriteRule (.*) http://sldgtv.com/$1 [R=301,L]
        
        # The Friendly URLs part
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
        RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
          • 3749
          • 24,544 Posts
          I'm not really qualified to answer. I'm not much of an expert on multi-context routing and I know nothing about the XRouting extra.

          I assume that you've seen this: https://modx.today/posts/2015/05/using-xrouting-for-multilingual-websites-in-modx.

          It looks pretty comprehensive. Note also that XRouting has a debug mode, which might help you.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 25197
            • 7 Posts
            I was never able to get Xrouting to work. I ended up using Context Router. I still had to adjust my .htaccess to be able to use friendly urls on both domains. I actually found the solution on a Wordpress forum ironically.