We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37234
    • 44 Posts
    MODX Revolution 2.1.3

    My redirects are adding weird query string (?q=info/index.asp) on the end of it, making the page resolve to a broken link.

    For example I've added this line to my .htaccess file:
    redirect 301 /info/index.asp http://www.newhair.com/about-us/
    So that the old page link http://www.newhair.com/info/index.asp will redirect to the new page.

    Something is going on because its adding some funky code to the url: http://www.newhair.com/about-us/?q=info/index.asp

    But if you just remove the "?q=info/index.asp" from the url manually after it loads, it goes to the correct page. Why is it adding "?q=info/index.asp" to the page?

    Here is a snippet of my .htaccess file
    # 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.
    #
    # 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]

    RewriteEngine On
    RewriteBase /



    # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
    #RewriteCond %{HTTP_HOST} .
    #RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
    #RewriteRule (.*) http://example-domain-please-change.com/$1 [R=301,L]
    #
    # or for the opposite domain.com -> www.domain.com use the following
    # DO NOT USE BOTH
    #
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.newhair\.com [NC]
    RewriteRule (.*) http://www.newhair.com/$1 [R=301,L]



    # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
    # https://www.domain.com when your cert only allows https://secure.domain.com
    #RewriteCond %{SERVER_PORT} !^443
    #RewriteRule (.*) https://example-domain-please-change.com.com/$1 [R=301,L]



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



    # Make sure .htc files are served with the proper MIME type, which is critical
    # for XP SP2. Un-comment if your host allows htaccess MIME type overrides.

    #AddType text/x-component .htc



    # If your server is not already configured as such, the following directive
    # should be uncommented in order to set PHP's register_globals option to OFF.
    # This closes a major security hole that is abused by most XSS (cross-site
    # scripting) attacks. For more information: http://php.net/register_globals
    #
    # To verify that this option has been set to OFF, open the Manager and choose
    # Reports -> System Info and then click the phpinfo() link. Do a Find on Page
    # for "register_globals". The Local Value should be OFF. If the Master Value
    # is OFF then you do not need this directive here.
    #
    # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
    #
    # Your server does not allow PHP directives to be set via .htaccess. In that
    # case you must make this change in your php.ini file instead. If you are
    # using a commercial web host, contact the administrators for assistance in
    # doing this. Not all servers allow local php.ini files, and they should
    # include all PHP configurations (not just this one), or you will effectively
    # reset everything to PHP defaults. Consult www.php.net for more detailed
    # information about setting PHP directives.

    #php_flag register_globals Off



    # For servers that support output compression, you should pick up a bit of
    # speed by un-commenting the following lines.

    #php_flag zlib.output_compression On
    #php_value zlib.output_compression_level 5



    # The following directives stop screen flicker in IE on CSS rollovers. If
    # needed, un-comment the following rules. When they're in place, you may have
    # to do a force-refresh in order to see changes in your designs.

    #ExpiresActive On
    #ExpiresByType image/gif A2592000
    #ExpiresByType image/jpeg A2592000
    #ExpiresByType image/png A2592000
    #BrowserMatch "MSIE" brokenvary=1
    #BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
    #BrowserMatch "Opera" !brokenvary
    #SetEnvIf brokenvary 1 force-no-vary

    redirect 301 /treatment/fue-fox-megasession.asp http://www.newhair.com/fue-megasession.html
    redirect 301 /fue2/ http://www.newhair.com/fue2.html
    redirect 301 /fue/ http://www.newhair.com/fue-introduction-to-follicular-unit-extraction-techniques.html
    redirect 301 /treatment/fut-automated-devices.asp http://www.newhair.com/automated-devices.html
    redirect 301 /treatment/fut-treating-women.asp http://www.newhair.com/treating-women.html
    redirect 301 /treatment/fut-racial-variations.asp http://www.newhair.com/racial-variations.html
    redirect 301 /treatment/fut-megasessions.asp http://www.newhair.com/megasessions.html
    redirect 301 /treatment/fut-fast-track-method.asp http://www.newhair.com/nhi-fast-track%C2%AE-method.html
    redirect 301 /treatment/fut-suturing-techniques.asp http://www.newhair.com/suturing-techniques.html
    redirect 301 /treatment/fut-follicular-units.asp http://www.newhair.com/follicular-units.html
    redirect 301 /treatment/fut-microscopic-dissection.asp http://www.newhair.com/stereo-microscopic-dissection.html
    [ed. note: helpmejesus last edited this post 14 years, 6 months ago.]
      • 31946
      • 116 Posts
      You're rewrite rules should be above the "Friendly URL's part" of modx.
      Also i think the syntax is wrong..
      Try to add your redirects like this above "# The Friendly URLs part".
      RewriteRule ^info/index.asp$ about-us/ [R=301,L]
      RewriteRule ^treatment/fut-automated-devices.asp$ automated-devices.html [R=301,L] 

        • 37234
        • 44 Posts
        Hmm no luck

        This link:
        http://www.newhair.com/info/index.asp

        Is still resolving to this (still putting "?q=info/index.asp" at the end of the URL):
        http://www.newhair.com/about-us/?q=info/index.asp

        Here is my .htaccess file:


        # 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.
        #
        # 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]

        RewriteEngine On
        RewriteBase /



        # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
        #RewriteCond %{HTTP_HOST} .
        #RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
        #RewriteRule (.*) http://example-domain-please-change.com/$1 [R=301,L]
        #
        # or for the opposite domain.com -> www.domain.com use the following
        # DO NOT USE BOTH
        #
        RewriteCond %{HTTP_HOST} .
        RewriteCond %{HTTP_HOST} !^www\.newhair\.com [NC]
        RewriteRule (.*) http://www.newhair.com/$1 [R=301,L]



        # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent
        # https://www.domain.com when your cert only allows https://secure.domain.com
        #RewriteCond %{SERVER_PORT} !^443
        #RewriteRule (.*) https://example-domain-please-change.com.com/$1 [R=301,L]

        RewriteRule ^treatment/fue-fox-megasession.asp$ fue-megasession.html [R=301,L]
        RewriteRule ^fue2/$ fue2.html [R=301,L]
        RewriteRule ^fue/$ fue-introduction-to-follicular-unit-extraction-techniques.html [R=301,L]
        RewriteRule ^treatment/fut-automated-devices.asp$ automated-devices.html [R=301,L]
        RewriteRule ^treatment/fut-treating-women.asp$ treating-women.html [R=301,L]
        RewriteRule ^treatment/fut-racial-variations.asp$ racial-variations.html [R=301,L]
        RewriteRule ^treatment/fut-megasessions.asp$ megasessions.html [R=301,L]
        RewriteRule ^treatment/fut-fast-track-method.asp$ nhi-fast-track%C2%AE-method.html [R=301,L]
        RewriteRule ^treatment/fut-suturing-techniques.asp$ suturing-techniques.html [R=301,L]
        RewriteRule ^treatment/fut-follicular-units.asp$ follicular-units.html [R=301,L]
        RewriteRule ^treatment/fut-microscopic-dissection.asp$ stereo-microscopic-dissection.html [R=301,L]
        RewriteRule ^treatment/fut-single-strip-harvesting.asp$ single-strip-harvesting.html [R=301,L]
        RewriteRule ^treatment/fut-nhi-master-plan.asp$ nhi-master-plan.html [R=301,L]
        RewriteRule ^treatment/follicular-unit-transplants.asp$ follicular-unit-transplants.html [R=301,L]
        RewriteRule ^treatment/basics-post-op.asp$ post-op-course-in-follicular-unit-transplantation.html [R=301,L]
        RewriteRule ^treatment/basics-procedure.asp$ understanding-the-procedure.html [R=301,L]
        RewriteRule ^treatment/basics-overview.asp$ an-overview-of-hair-transplantation.html [R=301,L]
        RewriteRule ^treatment/hair-transplant-basics.asp$ hair-transplant-basics.html [R=301,L]
        RewriteRule ^treatment/index.asp$ getting-started/ [R=301,L]
        RewriteRule ^info/contact.asp$ contact-information.html [R=301,L]
        RewriteRule ^info/news-views.asp$ 2004-golden-follicle-award.html [R=301,L]
        RewriteRule ^info/doctor-pak.asp$ jae-pak-m.d.html [R=301,L]
        RewriteRule ^info/doctor-rassman.asp$ william-r.-rassman-m.d.html [R=301,L]
        RewriteRule ^info/hair-doctors.asp$ about-us/ [R=301,L]
        RewriteRule ^info/history-timeline.asp$ nhi-timeline.html [R=301,L]
        RewriteRule ^info/history.asp$ history-of-nhi.html [R=301,L]
        RewriteRule ^info/nhi-way.asp$ the-nhi-way.html [R=301,L]
        RewriteRule ^info/events.asp$ upcoming-events.html [R=301,L]
        RewriteRule ^info/index.asp$ about-us/ [R=301,L]
        RewriteRule ^next/hair-loss-questions-faq.asp$ faq.html [R=301,L]
        RewriteRule ^fees/$ fees-and-financing.html [R=301,L]
        RewriteRule ^next/request-info.asp$ contact-information.html [R=301,L]
        RewriteRule ^next/consultation.asp$ schedule-a-consultation.html [R=301,L]
        RewriteRule ^next/hair-transplant-videos.asp?fl=no$ videos/ [R=301,L]
        RewriteRule ^next/repair-story-dean.asp$ procedure-1-the-surgery-page-1.html [R=301,L]
        RewriteRule ^next/other-photo-gallery.asp$ other-hair-restoration-photos/
        RewriteRule ^next/repair-photo-gallery.asp$ repair-work-photos/
        RewriteRule ^next/hairline-photo-gallery.asp$ hairline-photos/
        RewriteRule ^next/full-face-photo-gallery.asp$ full-face-photos/
        RewriteRule ^next/hair-restoration-photos.asp$ gallery/ [R=301,L]
        RewriteRule ^resources/links.asp$ expert-links.html [R=301,L]
        RewriteRule ^resources/nhi-newsletters.asp$ nhi-newsletters.html [R=301,L]
        RewriteRule ^resources/medical-publications.asp$ follicular-transplantation-patient-evaluation-and-surgical-planning.html [R=301,L]
        RewriteRule ^resources/hair-loss-in-women.asp$ hair-loss-in-women.html [R=301,L]
        RewriteRule ^resources/assessing-hair-loss.asp$ assessing-hair-loss.html [R=301,L]
        RewriteRule ^resources/hair-loss-causes.asp$ causes-of-hair-loss.html [R=301,L]
        RewriteRule ^resources/index.asp$ expert-resources/ [R=301,L]
        RewriteRule ^treatment/other-laser-therapy.asp$ laser-hair-transplants.html [R=301,L]
        RewriteRule ^treatment/other-cosmetic-camouflage.asp$ cosmetic-camouflage.html [R=301,L]
        RewriteRule ^treatment/other-hair-systems.asp$ hair-systems.html [R=301,L]
        RewriteRule ^treatment/other-tissue-expansion.asp$ tissue-expansion.html [R=301,L]
        RewriteRule ^treatment/other-flaps.asp$ flaps.html [R=301,L]
        RewriteRule ^treatment/other-scalp-reductions.asp$ scalp-reductions.html [R=301,L]
        RewriteRule ^treatment/other-laser-hair-transplants.asp$ low-laser-light-therapy-for-hair-loss.html [R=301,L]
        RewriteRule ^treatment/other-plug-grafts.asp$ plug-type-grafts.html [R=301,L]
        RewriteRule ^treatment/other-dilators.asp$ dilators.html [R=301,L]
        RewriteRule ^treatment/other-mini-micrografting.asp$ mini-micrografting.html [R=301,L]
        RewriteRule ^treatment/other-cloning-hair.asp$ cloning-hair.html [R=301,L]
        RewriteRule ^treatment/other-medications.asp$ medications.html [R=301,L]
        RewriteRule ^treatment/other-hair-loss-treatments.asp$ low-laser-light-therapy-for-hair-loss.html [R=301,L]
        RewriteRule ^treatment/corrective-fix-scarred-area.asp$ scarred-areas.html [R=301,L]
        RewriteRule ^treatment/corrective-repair-scalp-reduction.asp$ scalp-reductions.html [R=301,L]
        RewriteRule ^treatment/corrective-hide-large-grafts.asp$ camouflaging-large-grafts.html [R=301,L]
        RewriteRule ^treatment/corrective-repair-strategies.asp$ repair-strategies.html [R=301,L]
        RewriteRule ^treatment/corrective-wasted-donor-hair.asp$ wasted-donor-hair.html [R=301,L]
        RewriteRule ^treatment/corrective-fix-old-plugs.asp$ fixing-old-plugs.html [R=301,L]
        RewriteRule ^treatment/corrective-procedures.asp$ fixing-old-plugs.html [R=301,L]

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



        # Make sure .htc files are served with the proper MIME type, which is critical
        # for XP SP2. Un-comment if your host allows htaccess MIME type overrides.

        #AddType text/x-component .htc



        # If your server is not already configured as such, the following directive
        # should be uncommented in order to set PHP's register_globals option to OFF.
        # This closes a major security hole that is abused by most XSS (cross-site
        # scripting) attacks. For more information: http://php.net/register_globals
        #
        # To verify that this option has been set to OFF, open the Manager and choose
        # Reports -> System Info and then click the phpinfo() link. Do a Find on Page
        # for "register_globals". The Local Value should be OFF. If the Master Value
        # is OFF then you do not need this directive here.
        #
        # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
        #
        # Your server does not allow PHP directives to be set via .htaccess. In that
        # case you must make this change in your php.ini file instead. If you are
        # using a commercial web host, contact the administrators for assistance in
        # doing this. Not all servers allow local php.ini files, and they should
        # include all PHP configurations (not just this one), or you will effectively
        # reset everything to PHP defaults. Consult www.php.net for more detailed
        # information about setting PHP directives.

        #php_flag register_globals Off



        # For servers that support output compression, you should pick up a bit of
        # speed by un-commenting the following lines.

        #php_flag zlib.output_compression On
        #php_value zlib.output_compression_level 5



        # The following directives stop screen flicker in IE on CSS rollovers. If
        # needed, un-comment the following rules. When they're in place, you may have
        # to do a force-refresh in order to see changes in your designs.

        #ExpiresActive On
        #ExpiresByType image/gif A2592000
        #ExpiresByType image/jpeg A2592000
        #ExpiresByType image/png A2592000
        #BrowserMatch "MSIE" brokenvary=1
        #BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
        #BrowserMatch "Opera" !brokenvary
        #SetEnvIf brokenvary 1 force-no-vary

          • 31946
          • 116 Posts
          http://www.newhair.com/info/index.asp
          This link works fine for me, without adding the query string. Maybe delete your browser cache smiley