We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25483
    • 741 Posts
    Quote from: stevs at Aug 05, 2008, 08:18 AM

    awesome, that saved me a few hours. The shorter syntax does work but n.b newdir needs to be relative to the root not the sub dir containing the .htaccess file

    If you use the shorter syntax you have to set the RewriteBase when your modx install is in a subdir:

    RewriteBase /modxsubdir/



      with regards,

      Ronald Lokers
      'Front-end developer' @ h2o Media

      • 26388
      • 103 Posts
      Quote from: OpenGeek at Jul 30, 2008, 02:09 PM

      Quote from: rachel at Jul 30, 2008, 01:17 PM

      I have the 301 redirects below the mod_rewrite rules
      They have to come before the rewrite rules.

      This still doesn’t work. Here is the top of my htaccess file with the redirects coming before any of the rewrite rules:

      # MODx supports Friendly URLs via this .htaccess file. You must serve web
      # pages via Apache with mod_rewrite to use this functionality, and you must
      # change the file name from ht.access to .htaccess.
      #
      # Make sure RewriteBase points to the directory where you installed MODx.
      # E.g., "/modx" if your installation is in a "modx" subdirectory. If you have
      # problems with your .htaccess working at all, try un-commenting the first 
      # line above the "RewriteEngine On" directive.
      #
      # You may choose to make your URLs non-case-sensitive by adding a NC directive
      # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
      
      #Redirects
      Redirect 301 /learn-about-ranches.php		http://www.coloradoranch.com/explore-ranches.php
      Redirect 301 /horses.php					http://www.coloradoranch.com/horseback-riding.php
      Redirect 301 /cattle.php					http://www.coloradoranch.com/experiences-with-cattle.php
      Redirect 301 /children.php					http://www.coloradoranch.com/childrens-activities.php
      Redirect 301 /food.php						http://www.coloradoranch.com/accommodations.php
      Redirect 301 /typical-week.php				http://www.coloradoranch.com/your-week-on-the-ranch.php
      Redirect 301 /other-seasons.php				http://www.coloradoranch.com/seasons.php
      Redirect 301 /hunting.php					http://www.coloradoranch.com/seasons.php
      Redirect 301 /winter.php					http://www.coloradoranch.com/seasons.php
      Redirect 301 /b-and-b.php					http://www.coloradoranch.com/seasons.php
      Redirect 301 /family-reunions.php			http://www.coloradoranch.com/special-events.php
      Redirect 301 /weddings.php					http://www.coloradoranch.com/special-events.php
      Redirect 301 /conventions.php				http://www.coloradoranch.com/special-events.php
      Redirect 301 /find-a-ranch.php				http://www.coloradoranch.com/find-ranches.php
      Redirect 301 /search-for-ranches.php		http://www.coloradoranch.com/find-ranches.php
      Redirect 301 /map-of-ranch-locations.php	http://www.coloradoranch.com/find-ranches.php
      Redirect 301 /save-on-travel.php			http://www.coloradoranch.com/plan-vacation.php
      Redirect 301 /jobs.php						http://www.coloradoranch.com/ranch-jobs.php
      Redirect 301 /receive-a-brochure.php		http://www.coloradoranch.com/request-a-brochure.php
      
      #Options +FollowSymlinks
      RewriteEngine On
      RewriteBase /
      


      Still is appending the old file to the end of the urls like so: http://www.coloradoranch.com/accommodations.php?q=food.php

      What’s the solution? It’s very important for these to work properly for SEO purposes as well as people whom may have bookmarked pages from an old site design.
        • 36747
        • 138 Posts
        Instead of this
        Redirect 301 /learn-about-ranches.php http://www.coloradoranch.com/explore-ranches.php

        try this
        RewriteRule ^learn-about-ranches\.php$ hhttp://www.coloradoranch.com/explore-ranches.php [L,NC,R=301]


        Just put the code in the .htaccess file over this:
        # For Friendly URLs
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


        and then check in http://www.webconfs.com/redirect-check.php if the redirect is working.

        Good luck
          patagonia, argentina
          • 28690
          • 25 Posts
          Thank you @MediaGuy, this worked for perfectly for me:

          RewriteRule ^olddir/oldfile.php http://www.newsite.ext/newdir/newfile.html [L,NE,R=301]


          There are many posts on 301 redirects with modx friendly URLS (I have spent hours trying all of them) and this is the only one that works for me.

          Thanks again @MediaGuy for your alternative to permanent 301 redirects in modx with friendly URLS (FURLS). grin
            • 6146
            • 48 Posts
            Quote from: Stretch at Apr 12, 2010, 07:25 PM

            Thank you @MediaGuy, this worked for perfectly for me:

            RewriteRule ^olddir/oldfile.php http://www.newsite.ext/newdir/newfile.html [L,NE,R=301]


            There are many posts on 301 redirects with modx friendly URLS (I have spent hours trying all of them) and this is the only one that works for me.

            Thanks again @MediaGuy for your alternative to permanent 301 redirects in modx with friendly URLS (FURLS). grin

            Also after many hours of trying, this is the only solution that works for me too. Thanks @MediaGuy.
              • 12365
              • 1 Posts
              Hey All,

              I have been working at this all morning, and I have tried about every combination I can. My problem is the path is kind of odd from the old site.

              Old path: http://www.mysite.com/index.php/site/aboutus/
              New path: http://www.mysite.com/index.php?id=8

              Any suggestions?

              Thanks in advance!
                • 32519
                • 94 Posts
                Quote from: MediaGuy at Aug 05, 2008, 08:02 AM

                I did experience the same problem today rolleyes... I solved it by using this syntax:

                RewriteRule ^olddir/oldfile.php http://www.newsite.ext/newdir/newfile.html [L,NE,R=301]
                


                This code worked for me. Thank you.
                I’ve been searching for weeks for something like this, because I couldn’t get the Wayfinder display start tpl to work correctly so I made a sub-page (named home) that I intended to redirect to my real home page, but I could not get it working correctly until now. Thank You!

                Here is my .htaccess file:

                # 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
                # and especially for the first three commented out rules

                #php_flag register_globals Off
                #AddDefaultCharset utf-8
                #php_value date.timezone Europe/Moscow

                # For security reasons, Option followsymlinks cannot be overridden.
                #Options +FollowSymlinks
                Options +SymLinksIfOwnerMatch
                RewriteEngine On
                RewriteBase /

                # 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} !^www\.example\.com [NC]
                #RewriteRule (.*) http://www.example.com/$1 [R=301,L]
                RewriteRule ^home http://www.themovietimeline.net [L,NE,R=301]

                # 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,NC]

                # Reduce server overhead by enabling output compression if supported.
                #php_flag zlib.output_compression On
                #php_value zlib.output_compression_level 5
                  <a href="http://www.themovietimeline.net">The Movie Timeline</a> | <a href="http://www.antstuff.net">The Antfarm Site</a>