简体   繁体   中英

Raegular Expression to redirect based on start and end of URL

Good Morning! I'm a web developer, i'm still learning the ropes on a lot of things, and one of those is Regular Expressions, coding is not really my strong suit and I've run into something that is causing me way more trouble than I think it should.

We built a new news site for a client, They still have a few links from their old articles, I've got all the redirects set up for the main pages, but i'm running into trouble making redirects for the numerous articles.

I'd be happy with just redirecting anything that matches the profile back to the appropriate category page, because the new site's article names don't match the old ones.

The old article URLs follow this pattern. http://www.website.com.au/stories/Features/identifier15.11.05.php

And ideally i'd redirect them to http://www.archive.website.com.au/stories/Features/identifier15.11.05.php

Which is a copy of the old site that we hosted alongside the new one for this purpose.

I just don't wanna spend the whole day banging my head against a wall on this one, if anyone can give me some help with it, that'd be wonderful, thanks heaps.

RedirectMatch规则添加到.htaccess文件:

RedirectMatch 301 ^/(.*)$ http://www.archive.website.com.au/$1

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