We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37234
    • 44 Posts
    Hello, How can I do a mod rewrite so I can redirect old urls with variables to new pages. For example here is the code that is not working with variables in them. Here you can see the variable "id" in the url and trying to redirect to new pages. Any ideas?

    RewriteRule ^gallery/full-face-photos.asp?id=AJ$ new-page1.html [R=301,L]
    RewriteRule ^hairline/hairline-photos.asp?id=GG$ other-hairline2.html [R=301,L]
      • 3749
      • 24,544 Posts
      Try this:

      RewriteRule ^gallery/full-face-photos\.asp?id=AJ\$ new-page1.html [R=301,L]
      RewriteRule ^hairline/hairline-photos\.asp?id=GG\$ other-hairline2.html [R=301,L]



      ------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using.
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36618
        • 26 Posts
        When I do

         Redirect 301 /aboutold/ www.domain.com/aboutnew/ 


        I get

        http://www.domain.com/aboutnew/?q=aboutold/

        And it shows the homepage.. not the about page

        In my htacces there a rule with code:
         RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 


        Please tell my why and how to fix. [ed. note: lucasdegen last edited this post 14 years, 4 months ago.]