Little question with .htaccess rewrite rule.. I want to开发者_开发技巧 redirect http request like that:
http://example.com/~something/blabla/blablabla?blabla=blabla
as an request like that:
http://example.com/blabla/blablabla?blabla=blabla
Simply remove the ~something (with can be anything else but with an ~ at beginning...)
I have tried this code but not working at all...:
RewriteEngine on
RewriteRule ~something/(.*) $1 [P,L]
Something along these lines should work (this assumes use of a .htaccess file, IIRC you'll need to add a leading slash to the RewriteRule directive if you're doing this in your Apache config file instead):
RewriteEngine On
RewriteRule ~[^/]*/(.*) http://domain.com/$1 [R]
Either way, the RewriteLog and RewriteLogLevel directives (see http://httpd.apache.org/docs/current/mod/mod_rewrite.html) are your friends here.
精彩评论