We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16544
    • 86 Posts
    Hi guys! I want that everyone that type sitename.com to be redirected to www.sitename.com. I already type in my htaccess:
    RewriteCond % ^segaconsultores.com.ve[NC]
    RewriteRule ^(.*)$ http://www.segaconsultores.com.ve/$1 [L,R=301]


    but still nothing is happening. What am I doing wrong? Thanks. sad
      I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      RewriteCond %{HTTP_HOST} .
      RewriteCond %{HTTP_HOST} !^www\.example-domain-please-change\.com [NC]
      RewriteRule (.*) http://www.example-domain-please-change.com/$1 [R=301,L]
      
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        If it's hosted on MODX Cloud, keep in mind that because it runs nginx, you can't use .htaccess files there. There's a new Manage URL Rewrites function that allows you to enter nginx location blocks. We'll be adding some common examples and instructions for in the Cloud in the Userguide soon.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 16544
          • 86 Posts
          Sottwell, sorry that I told something different before but actually what I want to do is that if someone type www.mysite.com to be redirected to mysite.com. I tried:

          RewriteCond %{HTTP_HOST} ^www.segaconsultores.com.ve [NC] 
          RewriteRule ^(.*)$ http://segaconsultores.com.ve/$1 [L,R=301]

          and some pages look fine and other has no style, but if I select NO for friendly URL the redirection works fine. Any idea? Thanks.
          [ed. note: labanino last edited this post 13 years, 9 months ago.]
            I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
            • 16544
            • 86 Posts
            Never mind, I checked back on the friendly URL and everything is working as expected. Thanks.
              I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
              • 37044
              • 68 Posts
              Side note but I seem to recall you need to have a valid "base ref" -
              <base href="[[!++site_url]]">
              - in the head of your templates as well for FURLs and other relative URls to work as expected. So if your htaccess looks OK check this too - it tripped me up before!

              https://forums.modx.com/thread/74558/base-href-still-required-in-revolution-templates