1

I need a Rewrite Rule for apache to rewrite urls like:

http://saftsack.fs.uni-bayreuth.de/~dun3/archives/it/programming/fast-dynamic-property-access-using-reflection-emit/33.html

to

http://saftsack.fs.uni-bayreuth.de/~dun3/archives/fast-dynamic-property-access-using-reflection-emit/33.html

So, I need to remove all / parts between the "archives" and the last /, preserving the part before the / and after the /.

2 Answers 2

2

Something like this should do what you want:

RewriteRule ^(/~dun3/archives/).+?/([^/]+/[^/]+)$ $1$2 [L,R=301]

(The final R=301 part sends a HTTP 301 Moved Permanently header, which I presume is what you want to do, but if not you can simply omit that part.)

0
0
RewriteRule ^(.*?)/(.*?)/.*/(.*?)/(.*?)$ $1/$2/$3/$4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.