Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 3 of 3

This is a discussion on mod rewrite question in the Shared & Semi-Dedicated forum
I am trying to solve a problem using mod_rewrite: I'd like to take any uri that contains a string, say "foo", that occurs anywhere in ...

  1. #1
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,306

    mod rewrite question

    I am trying to solve a problem using mod_rewrite:

    I'd like to take any uri that contains a string, say "foo", that occurs anywhere in the request, and redirect it to an error page.

    For example, if someone tries to get to http://www.domain.com/willy/tryit.php?a=b&foo=3&date=4
    or
    http://www.domain.com/will/doit.php?foo=4&ron=33&andSoOn=5

    They will be redirected to

    http://www.domain.com/directory/errorpage.html


    I just can't get my .htaccess file to accomplish this seemingly easy task.
    The problem seems to reside in the fact that the target string is after the question mark or the ampersand... if I search for a string within the filename, the code works fine.

    I am trying to match using %{REQUEST_URI}

    Any suggestions?
    Last edited by Ron; 12-24-2004 at 01:14 PM.

  2. #2
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,306
    Solved using %{QUERY_STRING} instead.

    Apparently, mod_rewrites idea of what REQUEST_URI is different that the environment variable REQUEST_URI contains.

    Somewhere it's getting split into REQUEST_URI is being changed to something like REQUEST_FILENAME and QUERY_STRING

    I really ought to read a book about it someday.

  3. #3
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    I was just going to suggest that...
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

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
  •