We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2396
    • 101 Posts
    Hi,

    I'm trying to use .htaccess with Evo 1.0.5 to redirect the MODX 'auto generated' www.mydomain.com/index.html and www.mydomain.com/index.php to the root because Google indicates a duplicate content issue.

    The problem is that this causes a problem in the manager, whereby the entire manager is reloaded (duplicated) in the right content pane after the Save button is pressed - so I end up with a new manager, including the resource tree, loading alongside the existing resource tree pane and it keeps duplicating each time the edit is saved (and then the edit isn't actually saved by the manager anyway).

    I assume this is possibly because it is doing a site wide redirect of index files, including in the manager directory which is leading to issues - maybe it is possible to simply modify the code to exclude that folder from the rule?

    The code I am using (which successfully redirects both pages but wrecks the manager) is:
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?|php)(\?[^\ ]*)?\ HTTP/
    RewriteRule ^(([^/]*/)*)index\.(html?|php)$ http://www.mydomain.com/$1 [R=301,L]


    I have also tried using the following (which only successfully redirects index.php ...but also wrecks the manager):
    RewriteCond %{THE_REQUEST} ^.*/index\.html
    RewriteRule ^(.*)index.html$ http://www.mydomain.com/$1 [R=301,L]
    RewriteCond %{THE_REQUEST} ^.*/index\.php
    RewriteRule ^(.*)index.php$ http://www.mydomain.com/$1 [R=301,L]


    BTW, the rest of my .htaccess (preceeding the other code) is:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    
    Options +FollowSymLinks 
    RewriteEngine on 
    RewriteCond %{HTTP_HOST} ^mydomain.com [NC] 
    RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]


    Are there any server gurus that can help me out with an explanation or a possible fix? Thanks.