We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14778
    • 13 Posts
    If this problem has already been posted somewhere, feel free to just direct me there, but after a bit of searching I couldn’t find anything similar. Here’s my problem:

    We are redesigning a website and plugging it into modx. For SEO reasons, it is very important that we maintain old link urls (which of course are a pain in the you know what). Anyway, I have replicated with the page tree as best I can to allow for the same urls, but I have to have some extra levels to get the navigation to display correctly with Wayfinder. Here’s the difference in URLs:

    Should Be: .com/soap/green-soap.html
    Am Getting: .com/products/soap/green-soap.html

    With a little tweaking of the .htaccess (which I am really clueless on) I was able to get /products/ rewritten out of the URL, but now modx is redirecting me to the 404 for all pages that have been affected. Below you can see what I did to the .htaccess. Before this change, I just used the default one that comes with a modx install. Site is running on Evolution 1.0.

    # For full documentation and other suggested options, please see
    # http://svn.modxcms.com/docs/display/MODx096/Friendly+URL+Solutions
    # including for unexpected logouts in multi-server/cloud environments
    
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    
    # To maintain old URL path
    #RewriteRule ^load_cells1(.*) load_cells/$1
    RewriteRule ^products/?(.*) /$1 [R=301,L]
    #RewriteRule ^products/?(load_cells/)?(.*) /$1/$2 [R]
    #RewriteRule ^products/([^/]+)/([^/]+)?(.*) /$1/$2$3 [NC]
    
    # Fix Apache internal dummy connections from breaking [(site_url)] cache
    RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
    RewriteRule .* - [F,L]
    
    # Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin
    #RewriteCond %{HTTP_HOST} .
    #RewriteCond %{HTTP_HOST} !^example\.com [NC]
    #RewriteRule (.*) http://example.com/$1 [R=301,L]
    
    # Exclude /assets and /manager directories from rewrite rules
    RewriteRule ^(manager|assets) - [L]
    
    # For Friendly URLs
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    
    # Reduce server overhead by enabling output compression if supported.
    #php_flag zlib.output_compression On
    #php_value zlib.output_compression_level 5
    


    Thanks!
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: joshlasdin at Apr 02, 2010, 09:15 AM

      We are redesigning a website and plugging it into modx. For SEO reasons, it is very important that we maintain old link urls (which of course are a pain in the you know what). Anyway, I have replicated with the page tree as best I can to allow for the same urls, but I have to have some extra levels to get the navigation to display correctly with Wayfinder.
      IMO, the choice to add extra levels to display correctly in Wayfinder is the problem. You would be much better off replicating the structure properly and configuring Wayfinder (or finding/creating another snippet) to display your navigation properly. Site structure trumps dynamic menu construction.
        • 14778
        • 13 Posts
        Quote from: OpenGeek at Apr 02, 2010, 09:33 AM

        Site structure trumps dynamic menu construction.

        I agree and certainly still hold this as an option. I began constructing it this way because its how the site would make sense in terms of a sitemap. The clients current url structure is incredibly flawed, some drop down items contain parent directories in url, some don’t. Worse comes to worst, I’ll redo the page tree to allow for easy mapping of URLs, but if I can find a way to hide certain parents from the FURL it would kill both birds with one stone, keeping URLs the same, and having a sensible sitemap.
          • 3367
          • 7 Posts
          If you have access to the hosting controls (eg: CPanel), it’s far better to set 301 redirects for the old pages to the new MODx (especially for keeping SEO rankings). You might be able to just set some of the directories to wildcard settings to save time, but I usually prefer to do each 301 redirect by hand (just to make sure I have them all).

          By setting a host panel 301 control, the search engines will re-index the new pages much faster for the new pages as well (and adjust their listing links way quicker). I can be a bit of a pain (or feel like it at first), but it pays off SEO wise in the long run -- I’ve done it with quite a few sites ranging from 150-500 pages of redirects and have found the SE refresh the search listings to all the new URLs within a couple of weeks. In the meantime, any old SE links at least click immediately to the new pages.

          Having 2 browser tabs open (1 for old site, and one for MODx pages) makes it fairly easy -- Just switch back and forth using cut and paste for the URLs.

          I tend to avoid using the htaccess as well -- just don’t like messing with it (figuring I would screw something up with all the new URLs). But at least once a full panel 301 redirect is done it saves me having to worry about it later. Plus, since it’s done through the hosting panel, it leaves my htaccess and other files uncluttered and untouched.

          It’s also worth re-optimizing the new pages afterwards as well since you’ll likely have changes in relevancy if you’re using a new layout. It can really boost up the ranking strength.