We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25046
    • 194 Posts
    I am creating a new site that replaces quite an extensive old site (about 1,000 pages) and wanted an elegant way to map the old URL’s to the new URL’s. Of course, this is mainly to prevent 404 errors from search engine listings (and outdated customer bookmarks) and to make sure we don’t lose search engine rankings.

    I have attempted to do this with a modification to the .htaccess file with a line such as the following:

    RedirectPermanent /support/index.html http://www.<myNEWdomain>.com/products/support.html

    This ALMOST works but instead of getting rerouted to:

    http://www.<myNEWdomain>.com/products/support.html

    I get routed to

    http://www.<myNEWdomain>.com/products/support.html?q=support/index.html

    And the end result is I get a 404 error.

    Anybody have an idea what I can do to get rid of the portion of the URL that is tagged on at the end (in the above case, "?q=support/index.html")? I suppose this might have something to with the Friendly URLs code (pasted below for reference)? Of course, I want to keep the Friendly URLs funtionality.

    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]

    Or does somebody have any other suggestions?

    Thanks!



      • 25046
      • 194 Posts
      Wow, I found my answer and it’s a good one. I am now using Virtual Aliases (http://www.stanback.net/code/modx/virtual-aliases.html). So far (cross my fingers) it’s better than I was hoping for. For a particular page, I just enter a number of different aliases in a TV and the plugin permanently redirects the URL to the new one. Now all the shortcuts and URLs from the old site work and redirect perfectly on the new site.