[Web4lib] help with an Apache redirect

Thomas Dowling tdowling at ohiolink.edu
Mon Oct 12 10:43:41 EDT 2009


On 10/12/2009 09:58 AM, steven turner wrote:
> Hi All -
> 
> In Apache, I've been trying to write a redirect to perform a simple
> regex URL rewrite  using Mod_Redirect and/or Mod_Rewrite on a client
> request string, but I can't seem to get it to work...
> 
> I'm simply trying to replace the sub-string "/~"  (that's a backslash
> and a tilde) with the substring "/legacy" in this example/theoretical
> URL: "http://www.lib.usm.edu/~spcol/folderName/pageTitlle.php"
> 


It's a shot in the dark, but my first hunch would be to backslash-escape it,
since the tilde has special meaning in regexp-speak.

  RedirectMatch /\~(.*) http://ourserver.edu/legacy$1

And just to cover the few referers that hex-escape tildes in URLs:

  RedirectMatch /%7E(.*) http://ourserver.edu/legacy$1


-- 
Thomas Dowling
tdowling at ohiolink.edu





More information about the Web4lib mailing list