简体   繁体   中英

Apache2: Mod_rewrite wildcard text.html

We have changed e-commerce vendors and I need to perserve some of the SEO we've done. I want to do a 301 for a set of pages to a single new URL

I have a set of pages that end all with the same tickets.htm. So, for example, I have a pages like /blank_tickets.htm and /concert_tickets.htm and the list goes on.

So I tried this: 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.

Thanks!

You didn't escape the dot. Use \\. in your regular expression at the .htm part.

Edit: also use the [R=301] flag, or simply [R] to produce a HTTP 301 header.

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