[英]Mod_rewrite rule for one URL with percent
I don't get it. 我不明白 I have a htacces-file for single URLs to be redirected. 我有一个用于重定向单个URL的htacces文件。
example: 例:
Redirect 301 /upload/pdfs/2014/12345678.pdf /upload/documents/12345678.pdf
Ok, works so far. 好的,到目前为止。
But now I have to redirect this URL: 但是现在我必须重定向此URL:
/com/cars/detail/1234/[DB%0A%0Alink].html /com/cars/detail/1234/[DB%0A%0Alink].html
to: 至:
http://www.domain.de/Car-JohnDoe http://www.domain.de/Car-JohnDoe
I've tried a lot of expressions like: 我尝试了很多类似的表达式:
Redirect 301 /com/cars/detail/1234/[DB%0A%0Alink].html http://www.domain.de/Car-JohnDoe
Redirect 301 /com/cars/detail/1234/([^0-9]*) http://www.domain.de/Car-JohnDoe
Redirect 301 /com/cars/detail/1234/([^0-9]*)$ http://www.domain.de/Car-JohnDoe
Redirect 301 /com/cars/detail/1234/(.*)$ http://www.domain.de/Car-JohnDoe
Redirect 301 /com/cars/detail/1234/(.*)$ http://www.domain.de/Car-JohnDoe
RedirectMatch 301 ^/com/cars/detail/1234/(.*)$ http://www.domain.de/Car-JohnDoe
Redirect 301 /com/cars/detail/1234/[DB\%0A\%0Alink].html http://www.domain.de/Car-JohnDoe
But nothing worked at all. 但是什么都没有。 The "1234" is an ID, so everything that comes afer that coul be a wildcard/placegolder. “ 1234”是一个ID,因此,该命令之后的所有内容都将是通配符/占位符。 But actually I need a rule only for this single URL. 但是实际上我只需要针对该单个URL的规则。
I hope you understand what I mean (sorry for my bad english)... 我希望你能理解我的意思(对不起我的英语不好)...
Best wishes Bazi 祝福巴兹
This should work to match /com/cars/detail/1234/[DB%0A%0Alink].html
and redirect to /Car-JohnDoe
: 这应该可以匹配/com/cars/detail/1234/[DB%0A%0Alink].html
并重定向到/Car-JohnDoe
:
RedirectMatch 301 "^/com/cars/detail/1234/\[DB\s+link\].html" /Car-JohnDoe
For other rules also make sure to use RedirectMatch
instead of Redirect
对于其他规则,还请确保使用RedirectMatch
而不是Redirect
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.