SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Middle Earth
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't trigger the redirect

    I need to redirect the URL like viewforum.php?f=123 in Apache main conf file, I have tried every format I can think of, but it still doesn't trigger it. I have something very similar which works well, the only difference is that one doesn't have the question mark. Here is what I have tried:

    RewriteEngine On
    RewriteRule viewforum\.php\?f=([0-9]+) http://www.newdomain.com/phpbb2vb.php?oldforumid=$1 [L,R=301]
    RewriteRule ^viewforum\.php\?f=([0-9]+)$ http://www.newdomain.com/phpbb2vb.php?oldforumid=$1 [L,R=301]
    RewriteRule ^/viewforum\.php\?f=([0-9]+)$ http://www.newdomain.com/phpbb2vb.php?oldforumid=$1 [L,R=301]
    RewriteRule ^/viewforum.php?f=([0-9]+)$ http://www.newdomain.com/phpbb2vb.php?oldforumid=$1 [L,R=301]
    RewriteRule ^/viewforum.php/?f=([0-9]+)$ http://www.newdomain.com/phpbb2vb.php?oldforumid=$1 [L,R=301]
    ....
    And other possible combinations.

    None of them worked, I have worked on this since yesterday. Any help would be greatly appreciated.

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,645
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    h_s,

    You're joking, aren't you?

    A RewriteRule cannot access a query string; it can only retain, add to or delete a query string but it cannot gain access to a pre-existing query string!

    IMHO, you, too, could benefit (as members have for years) by reading the tutorial article linked in my signature (much of which has been turned into the second sticky thread ... linked where you initialted this thread). In fact, I believe you'll find the code you need there (signature link) to perform this task.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Middle Earth
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, David, I will study the links in you signature.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    Middle Earth
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It worked after removing the query string. Thanks again.


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
  •