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

    I have a strange problem on one Evo site with manual redirects.

    I like to redirect old urls to new pages after site update to modx and I've done it several times with this same formula before with no issues.

    Example:
    # Exclude /assets and /manager directories and images from rewrite rules
    RewriteRule ^(manager|assets)/*$ - [L]
    RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L]
    
    # old site redirects
    RewriteRule ^oldpage.php$ /newpage [L,R=301]
    
    # For Friendly URLs
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    


    So manual rewrite rules are placed between "Exclude /assets and /manager..." and "For Friendly URLs" part of original Evo .htaccess rules.

    I've done this on multiple sites before but now on one site it's acting strangely: Every page that has manual rule set works like excepted but all the others leave "q" parameter visible to url. So alias "somepage" becomes www.domain.com/?q=somepage

    If I try to place manual rewrite rules after the "For Friendly URLs" part they won't obviously work.

    Any help would be much appreciated!


    EDIT:

    Reason why this happened was that there was rewiterule for index.php (old site homepage).

    This of course messed up MODX default rewrites.

    RewriteRule ^index.php$ / [L,R=301]
    

    So I removed this row and everything runs now like excepted. [ed. note: Roope last edited this post 13 years, 11 months ago.]