SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to redirect query string with htaccess

    I'm new here and I got this htaccess code to redirect:
    ## 301 Redirect Entire Directory
    RedirectMatch 301 teamfront.php?(.*) /$1

    It is redirecting fine from:
    example.com/teamfront.php?Adobe-Acrobat-XI-Standard
    to
    example.com/?Adobe-Acrobat-XI-Standard
    but not linking to respective page
    also fine if it link to:
    example.com/Adobe-Acrobat-XI-Standard
    anybody please help me. Thanks in advance
    Last edited by DaveMaxwell; Aug 27, 2013 at 06:41. Reason: anonymized URLs

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,031
    Mentioned
    152 Post(s)
    Tagged
    2 Thread(s)
    I'm pretty sure you can't do that with RedirectMatch since it doesn't take the query string into account.

    What you want is something along the lines of

    Code:
    Options +FollowSymlinks -MultiViews
    
    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^(.*)$
    RewriteRule ^teamfront\.php$ /%1 [L,R=302]
    Once it all works, replace 302 with 301 (browsers cache 301 so it's very hard to test rules with 301, but they don't cache 302, so it's easier to test with that).
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for reply, I try to copy the above code and paste into htaccess but it is not working, getting 404 error instead. I try with 301 too but no luck.

  4. #4
    SitePoint Member
    Join Date
    Aug 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please anybody help me to solve above issue, It would be great full for me..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •