We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26439
    • 104 Posts
    Howdy, I’ve been requested to work out a way to redirect MySite.com to www.MySite.com. ( Search Engine Optimization )

    I have used this method in the default .htaccess file.


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

    This caused 404’s ( within the ModX environment) before I commented out this line....


    # RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    Not knowing hardly anything about .htaccess I thought I’d post a quick thread, in case someone knows of a better way to achieve what I am trying to do, perhaps within the ModX configuration, or in the highly likely case that someone sees potential problems caused by my playing around where I probably shouldn’t be.

    Comments about the worthwhileness of this endeavour in respect to SEO are also welcome.
    • If the purpose is just to put a "www." in front, then it’s pointless. If the purpose is because Google has a boatload of pages indexed already with the "www." then it makes sense.
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 26439
        • 104 Posts
        From here.


        "Normal" server configuration, as set up by most clueless hosting companies, allows you to access your site at either non-www or at www. In effect you have two identical sites. They fail to realise that search engines like Google see these two sites as being separate copies, not "one" site.

        Search engines do not want to index the same content twice, so they try to filter one copy out. That means that your PageRank suffers. You have already seen that in effect, a site with domain.com/page.html with a PR3 and the "same" page at www.domain.com/page.html with a PR6.

        If the redirect had been done properly, only www.domain.com/page.html would be listed and it might be PR7.
        • This is very easy to handle with .htaccess and still works with MODx rewrite rules...try placing something like this before the RewriteEngine On line in your .htaccess.

          RedirectMatch permanent ^/mysite.com$ http://www.mysite.com

            • 26439
            • 104 Posts
            Quote from: OpenGeek at May 29, 2006, 03:54 PM

            RedirectMatch permanent ^/mysite.com$ http://www.mysite.com


            That doesn’t seem to want to work for me for some reason.
              • 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