简体   繁体   中英

How to set a specific RewriteRule?

I´m setting up a new RewriteRule and the Webpage will not be shown. It throws a HTTP-Error like 404 or BadRequest. This depends on the combination which i use. Is the rewrite which i want to use in general possible?

We want to configure following Rewrite:

This Rewrite works:

RewriteRule ^/context1/contetx2/context3/context4/Reisen.de.html  https://www.test.at/context1/contetx5/context6/2018/context7/Reisen.html  [R=301,L]

But we want to "remove" the Path/Location "2018" in the URL which is shown in the browser. It should looks like: https://www.test.at/context1/contetx5/context6/context7/Reisen.html

I treid already a lot of combinations with R, QA, P, L, PT; ProxyPass, RewriteCond and so on.

Expected: enter the URL: https://www.test.at/context1/contetx2/context3/context4/Reisen.de.html

shown in Browser (adress-line): https://www.test.at/context1/contetx5/context6/context7/Reisen.html

Content is reachable with: https://www.test.at/context1/contetx5/context6/2018/context7/Reisen.html

Try:

RewriteRule ^/context1/contetx2/context3/context4/Reisen.de.html  /context1/contetx5/context6/context7/Reisen.html  [R=301,L]
RewriteRule ^/context1/contetx5/context6/context7/Reisen.html  /context1/contetx5/context6/2018/context7/Reisen.html  [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM