Forum Moderators: phranque
I searched this forum and applied few examples but without any success, so decided to ask community for advice....
The story: I have a number of "lottery.shtml" pages located in deferent folders (based on countries)
On my new site I have to redirect all of them to one new page.
Now I'm using the following logic:
-------------------------------
Redirect 301 /UK/lottery.shtml http://www.example.com/world-lottery-association-lottery-results
Redirect 301 /DE/lottery.shtml http://www.example.com/world-lottery-association-lottery-results
Redirect 301 /SP/lottery.shtml http://www.example.com/world-lottery-association-lottery-results
Redirect 301 /FR/lottery.shtml http://www.example.com/world-lottery-association-lottery-results
......
--------------------------------
But because I have the similar logic all around my old site, my new .htaccess file quickly became a big enough, so I decided to try RedirectMatch for this (if possible).
The idea is: doesn't matter which folder, if name of requested file is "lottery.shtml" --- redirect to "http://www.example.com/world-lottery-association-lottery-results"
I tried the following but it doesn't work:
RedirectMatch 301 ^([^/]+/)?lottery.shtml$ http://www.example.com/world-lottery-association-lottery-results
Please advice
Regards,
Olegin
[edited by: jdMorgan at 4:16 am (utc) on April 4, 2008]
[edit reason] example.com [/edit]
RedirectMatch 301 [b]^/([/b][^/]+/)?lottery\.shtml$ http://www.example.com/world-lottery-association-lottery-results
Your code works perfect to redirect to SEF URL like http://www.example.com/world-lottery-association-lottery-results
But I didn't realize that there is lots of not SEF/original URLs.
------------------------------------------
RedirectMatch 301 ^/([^/]+/)?lottery\.shtml$ http://www.example.com/index.php?option=com_content&Itemid=129&id=176&lang=en&view=article
-------------------------------------------
I'm getting Error404, result in the browser is:
--------------------------------------
http://www.example.com/index.php%3foption=com_content/lottery.shtmlItemid=129/lottery.shtmlid=176/lottery.shtmllang=en/lottery.shtmlview=article
-----------------------------------
so, all "&" replaced with "/lottery.shtml"
Is there any way to prevent this?
Thanks in advance
Olegin