开发者

htaccess - remove parts from URL

I've been working on that for 2 days now. Reading everything I could find about .htaccess rewrite. But I'm just not getting what I want.

Here's what I have:

http://www.domain.com/this/andthis/function.file-get-contents/

And this is what I need:

开发者_如何学Go
http://www.domain.com/this/andthis/

For some reason, the browser goes to http://www.domain.com/ My htaccess file contains these two lines:

RewriteCond %{REQUEST_URI} (.*)(function\.file-get-contents)
RewriteRule . $1 [R=301]

Also, I could not find what %{REQUEST_URI} is... I kinda feel stupid.

What am I doing wrong? Any ideas?


Try this:

RewriteRule ^(.*)function\.file-get-contents $1 [L,R=301]

Here you don't need a RewriteCond.


Just do this

RewriteRule (.*)/(.*)/function\.file-get-contents $1/$2 [R=301]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜