Here is the begining of my .htaccess
# invoke rewrite engine RewriteEngine On RewriteBase /~new # force non domain.com to www.domain.com RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301,L,NC]
everytime I request http://www.example.com/~new/whatever I am sent to http://www.example.com/whatever . I placed brackets around the $1 and I get http://www.example.com/%5Bwhatever%5D.
Why is it stripping out my RewriteBase var ?
Or, is there a way to set an environmental variable in .htaccess that I can set RewriteBase to and also put in front of the $1 to make the redirection work?
Well, that’s kind how RewriteBase works: it blows away all leading path information from your request, and then reinserts the RewriteBase afterward. But in your example, it can’t perform the reinsertion because you’re giving it a redirect to a fully-qualified URL.
I think you should back up and define exactly what you’re trying to do, and possibly ask a new question about that, instead of assuming that RewriteBase is what you need to be using and focusing on ‘why isn’t RewriteBase doing what I want’. RewriteBase may be nothing to do with it.