base can be either: 1. http://www.mydomain.com/ OR 2. http://www.mydomain.com/myfolder/ i need to rewrite: base/anynumber/anystring to base?var=anynumber e.g. http://www.mydomain.com/myfolder/5/hello to http://www.mydomain.com/myfolder/?var=5 or http://www.mydomain.com/5/hello to http://www.mydomain.com/?var=5 anystring is completely ignored... anyone?
Try this: Options +FollowSymLinks RewriteEngine on RewriteRule /myfolder/(.*)/(hello)/$ /myfolder/?$1=$2 RewriteRule /(.*)/hello/$ /?$1=$2
RewriteEngine on # Rewrite /somedigit(s)/whatever to /?var=somedigit(s) RewriteRule ^/([0-9]+)(/.*)?$ /?var=$1 [L] # Rewite /somedir/somedigit(s)/whatever to /somedir/?var=somedigit(s) RewriteRule ^/([^/]+)/([0-9]+)(/.*)?$ /$1/?var=$2 [L] Code (markup): Initial directory (optional) will be preserved. Subsequent digit(s) will be added to query string (?var=5). Anything past the digit(s) will be discarded. Dont forget the [L] flag. I hope that helps. - IntelliGuy