开发者

.htaccess rewrite rule from http://example.com/~something/blabla to http://example.com/blablabla

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜