开发者

Mod_Rewrite assistance for a noob please

开发者 https://www.devze.com 2023-04-11 02:32 出处:网络
I want to rewrite all URLs of the form: http://www.site.com/push20/dir1/dir2/afile.html to http://www.开发者_运维知识库site.com/dir1/dir2/afile.html

I want to rewrite all URLs of the form:

http://www.site.com/push20/dir1/dir2/afile.html

to

http://www.开发者_运维知识库site.com/dir1/dir2/afile.html

I.e. lose the push20 bit

I've tried with:

RewriteEngine On
RewriteRule ^push20/(.*) /$1 [R]

but its not happening.

Any suggestion?


Won't you need a leading / before push20?

i.e:

RewriteRule ^/push20/(.*) /$1 [R]


Unless I'm missing something, you can do this with a standard Redirect directive, something along these lines:

Redirect /push20 /

That should redirect everything under /push20 to the root of your site -- basically it strips out push20 and redirects.

0

精彩评论

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