apache - 如何设置特定的 RewriteRule?
问题描述
我正在设置一个新的 RewriteRule 并且不会显示网页。它会抛出一个 HTTP 错误,如 404 或 BadRequest。这取决于我使用的组合。我想通常使用的重写是否可能?
我们要配置以下重写:
此重写有效:
RewriteRule ^/context1/contetx2/context3/context4/Reisen.de.html https://www.test.at/context1/contetx5/context6/2018/context7/Reisen.html [R=301,L]
但是我们想在浏览器中显示的 URL 中“删除”路径/位置“2018”。它应该看起来像: https ://www.test.at/context1/contetx5/context6/context7/Reisen.html
我已经用 R、QA、P、L、PT 进行了很多组合;ProxyPass、RewriteCond 等。
预期:输入网址: https ://www.test.at/context1/contetx2/context3/context4/Reisen.de.html
显示在浏览器(地址行)中: https ://www.test.at/context1/contetx5/context6/context7/Reisen.html
内容可通过以下方式访问: https ://www.test.at/context1/contetx5/context6/2018/context7/Reisen.html
解决方案
尝试:
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]
推荐阅读
- sql - SQL PowerShell 比较数组
- angular - Filter table in Angular
- node.js - 顺序递增跳过数字
- javascript - Intermittent "TypeError: "exports" is read-only" error with Webpack and Vue-CLI
- c# - 多列搜索条件 GridView
- java - Java - 返回命令
- c++ - (C++) Trying to finish up a quick program but I'm not sure where I went wrong?
- c# - LINQ foreach 语句获取项目不工作
- javascript - 根据输入字段中的鼠标移动查找字符位置
- c# - How to launch WindowsInternal.ComposableShell.Experiences.TextInput.InputApp