mercuriuscreative Posted February 16, 2016 Share Posted February 16, 2016 Hi, I need to change how 404 redirects work. I just converted this site from an old non prestashop website to prestashop. There are a lot of old addresses which are now 404. I would like to redirect ALL 404 errors as a 301 redirect to the homepage. My PrestaShop version is 1.6.1.4 SEO URLs are on. How can this be done? Link to comment Share on other sites More sharing options...
mercuriuscreative Posted February 17, 2016 Author Share Posted February 17, 2016 Ok, I think I solved it on my own... If you're interested. (I could not find a clear example that worked) Step 1-- Copy the file /controllers/front/PageNotFoundController.php Step 2-- Paste the file into: /override/controllers/front/PageNotFoundController.php Step 3-- Edit the file: Right after the /* comments */ paste... header( "HTTP/1.1 301 Moved Permanently" ); header( "Location: http://YOURWEBADDRESSHERE/" ); exit(); Step 4-- After that the rest of the code is still there. So, just save the file. Step 5-- Locate /cache/class_index.php Step 6-- delete the file or append the filename with OLD That's it. That worked for me. All missing pages now go to the homepage. Some people don't recommend this, and maybe it isn't the most graceful way to do this on PrestaShop, but it works for me. Let me know if you see a problem, or have some advice. 1 Link to comment Share on other sites More sharing options...
naoufel Posted January 17, 2018 Share Posted January 17, 2018 Could you please let me know what do you mean with "Right after the /* comments */"? which comments are you refering to? Thank you, Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now