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:
开发者_如何学Gohttp://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]
精彩评论