简体   繁体   English

Apache2:Mod_rewrite通配符text.html

[英]Apache2: Mod_rewrite wildcard text.html

We have changed e-commerce vendors and I need to perserve some of the SEO we've done. 我们已经改变了电子商务供应商,我需要保留一些我们已经完成的SEO。 I want to do a 301 for a set of pages to a single new URL 我想对一组页面执行301操作,以将其指向一个新的URL

I have a set of pages that end all with the same tickets.htm. 我有一组页面都以相同的tickets.htm结尾。 So, for example, I have a pages like /blank_tickets.htm and /concert_tickets.htm and the list goes on. 因此,例如,我有一个类似/blank_tickets.htm和/concert_tickets.htm的页面,列表继续。

So I tried this: RewriteRule ^/(.*)tickets.htm$ /t/tickets/types/standard 所以我尝试了这个:RewriteRule ^ /(。*)tickets.htm $ / t / tickets / types / standard

I tried variations of this no leading / no $, etc. 我尝试了这种无前导/无美元等的变体

I'm sure I'm missing something simple but my Google-fu is not returning a relevant example. 我确定我遗漏了一些简单的东西,但是我的Google-fu没有返回相关示例。

Thanks! 谢谢!

You didn't escape the dot. 您没有逃脱点。 Use \\. 采用 \\。 in your regular expression at the .htm part. 在.htm部分的正则表达式中。

Edit: also use the [R=301] flag, or simply [R] to produce a HTTP 301 header. 编辑:也可以使用[R = 301]标志,或仅使用[R]来产生HTTP 301标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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