Mister Denial Posted January 17, 2012 Share Posted January 17, 2012 Hi everyone, I recently switched to Prestashop, which has an entirely different structure my old website had. In order to avoid a flood of 404's I would like to redirect the main pages, but this creates a huge htaccess file. Currently there redirects look like this: #NECKLACES redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_01.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_02.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_03.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_04.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_05.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_06.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_07.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_08.html /6-gothic-necklaces redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces_09.html /6-gothic-necklaces There has to be a better way to write this, no? Can someone help me with this? I am lousy at coding. Your help is much appreciated! Best regards, Dan Link to comment Share on other sites More sharing options...
tomerg3 Posted January 17, 2012 Share Posted January 17, 2012 If there is a specific pattern that always happens, it's possible to do a general redirect using regex, but if that is not the case, you would need to have individual records for each. It's hard to tell just by that one example. Link to comment Share on other sites More sharing options...
Mister Denial Posted January 19, 2012 Author Share Posted January 19, 2012 Hi tomerg, many thanks for your help! There are are multiple pages that have the same URL string, with juste one page variable in the end. Considering there sometimes are up to 10 pages, having a conditional rewrite might be better than having ten separate redirects. But I have no clue on how to write it, as I am absolutely not familiar with this language. If someone could give me an code snippet based on the above example, I would be able to rewrite all the other pages too. Best regards, Dan Link to comment Share on other sites More sharing options...
tomerg3 Posted January 20, 2012 Share Posted January 20, 2012 I have not tested this, so please on one URL first. redirect 301 /contents/en-us/d356_gothic-shop-pendants-necklaces(.)?$ /6-gothic-necklaces There are many good beginner tutorials, you can check out http://www.addedbyte...-for-beginners/ Link to comment Share on other sites More sharing options...
Mister Denial Posted January 23, 2012 Author Share Posted January 23, 2012 Hi tomerg, I tried that, but it's not working. I will check out the link you sent, and see if I can manage with that. Thanks! Cheers! Dan Link to comment Share on other sites More sharing options...
Mister Denial Posted January 23, 2012 Author Share Posted January 23, 2012 Hi, okay, the solution that works looks like this: RewriteRule ^some-string http://www.domain.com/index.php/blog/target [R] Thanks for the help, SOLVED! Dan Link to comment Share on other sites More sharing options...
Recommended Posts