[Web4lib] help with an Apache redirect
Andrew Hankinson
andrew.hankinson at gmail.com
Mon Oct 12 10:37:17 EDT 2009
I'm assuming you want to replace "/~spcol" with "/legacy/spcol". In
that case, you can try:
RewriteRule "^/~([\w\d\W\D]+)" http://www.example.com/legacy/$1
Everything inside the () is captured as variable $1, and then appended
at the end of the URL. \w captures words, \d captures digits; their
capital variations capture not words and not digits, respectively.
Basically this says "capture anything that comes after a tilde, and
write the URL with that."
Hope that helps.
-Andrew
On 12-Oct-09, at 9: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
> "
>
> Any takers out there? Help on this would be greatly appreciated, as
> it's been a bugbear for me for quite some time - can't have users
> ending up in deprecated places all the time...
>
> Thanks
>
> Steve
> -----------------------------------------
> Steven Turner
> Library Web Services Manager
> Associate Professor
> The University of Southern Mississippi
> Cook Library
> -----------------------------------------
> email: steven.turner at usm.edu
> phone: 601.266.4066
> -----------------------------------------
>
>
>
>
>
>
>
> _______________________________________________
> Web4lib mailing list
> Web4lib at webjunction.org
> http://lists.webjunction.org/web4lib/
>
More information about the Web4lib
mailing list