Web Hosting Talk







View Full Version : mod_rewrite


PlanetWebHost
05-05-2006, 07:01 AM
Hey guys,

I need a mod_rewrite rule to convert /~somevalue/ to / without intefering without any subdirectories or $_GET variables that come after.

Basicailly, any URL with a ~ goes back to the same place, without passing any values.


http://someurl.com/~value1 -> http://someurl.com/
http://someurl.com/~390s9/script.php -> http://someurl.com/script.php
http://someurl.com/~390s9/script.php?var=val -> http://someurl.com/script.php?var=val


Thanks in advance

PlanetWebHost
05-05-2006, 09:19 PM
the guys at http://forum.modrewrite.com/ helped me out with this,

RewriteEngine On
RewriteRule ^~[^/]+/?$ / [QSA,L]
RewriteRule ^~[^/]+/(.+)$ /$1 [QSA,L]