views:

15

answers:

1

Hello all

Little question with .htaccess rewrite rule.. I want to redirect http request like that :

http://domain.com/~something/blabla/blablabla?blabla=blabla

as an request like that :

h ttp://domain.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]

Thanks a lot :)

Olivier

A: 

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.

Will
That's work fine. Thanks a lot :) See you next time and Thanks again that help me a lot ! :)
Olivier Bossel