We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31227
    • 198 Posts
    Hey people,
    I am in the process of redoing a website, however this time with quite a bit of attention towards SEO optimisation. My task is simple to migrate the search engines as smoothly as possible. I would like a 301 redirect from an old page hard link to the new page hard link (although doc id stays the same). I have found a plug-in called NG!Redirect (gives the ability to move hard link to hard link) and Missing (gives the ability to move old hard link to ID), unfortunately non of them seemed to work for me. Any ideas? I had also found a snippet posted by scrafy96 (so all credit goes to him:p)
    <?php
    $redirect = array(
    '/directory1/' =>2438,
    '/directory1/index.html' =>2438
    );
    
    $referring_url = getenv("REQUEST_URI");
    #echo 'Referring url = '.$referring_url.' redirecting to :'.$redirect[$referring_url];
    if (isset($redirect[$referring_url])) {
    	$modx->sendRedirect($modx->makeUrl($redirect[$referring_url], '', '', 'full'), 0, 'REDIRECT_HEADER', '301');
    }
    ?>

    The way this snippet should work is basically call the snippet [[redirect]] on the 404 page and it should redirect a page if it finds it unfortunately it did not work for me - I tried calling hard-links and ids but again no luck:(
    I know there is a way to use .htaccess for the redirect i.e:
    Redirect 301 /old.html http://www.blabla.com/new.html
    How ever as I am using FURL (and have to use it)
    Redirect 301 /old.html http://www.blabla.com/new.html
    Does not work, the only way I could get this to work is
    Redirect 301 /old.html http://www.blabla.com/?q=PAGEID
    But this redirect to a url http://www.blabla.com/?q=PAGEID instead of http://www.blabla.com/new.html
    *GULP*... any ideas?

    EDIT: just found this plug in http://www.stanback.net/code/modx/virtual-aliases.html but I have no idea how to insert the links other than that they go into a tv... No info given on site:(
      Pure MODx sites
      Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
      • 31227
      • 198 Posts
      *bump* sorry ppl, need this done
        Pure MODx sites
        Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
        • 31227
        • 198 Posts
        grrr... huh huh
          Pure MODx sites
          Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
          • 33238
          • 388 Posts
          mate, could you solve the problem??

          thank you!
            --
            ysanmiguel.com
            • 33238
            • 388 Posts
            Solution is simple.

            just find this code inside .htaccess

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


            Modify and paste this code over the code above.

            RewriteRule ^oldpage\.html$ http://www.samplepage.com/new page.html [L,NC,R=301]
            


            that is all.
            should looks like this:

            RewriteRule ^oldpage\.html$ http://www.samplepage.com/new page.html [L,NC,R=301]
            
            # For Friendly URLs
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
            


            grin i hope this works!!!
              --
              ysanmiguel.com