PrestaShop Documentation, PrestaShop Tutorials

PrestaShop how to set 301,404,50,0 and other redirects from .htaccess file

You can set up redirects for different HTTP status codes in PrestaShop using the .htaccess file. Here’s how you can do it:

1. Edit the .htaccess file

  • The the .htaccess file is usually located in the root directory of your PrestaShop installation.
  • Open it with a text editor (like Notepad++, VS Code, or any code editor).

2. Add Redirect Rules

Below are examples of redirect rules for different status codes:

301 Permanent Redirect (Moved Permanently)

Redirect 301 /old-page.html https://www.presta-addons-modules.com/en/seo/prestashop-seo-automatic-google-rich-snippets-json-ld-opengraph-twitter-tags-schemaorg.html

302 Temporary Redirect

Redirect 302 /temporary-page.html https://www.presta-addons-modules.com/en/seo/prestashop-seo-automatic-google-rich-snippets-json-ld-opengraph-twitter-tags-schemaorg.html

404 Redirect (Page Not Found)

ErrorDocument 404 https://www.presta-addons-modules.com/en/seo/prestashop-seo-automatic-google-rich-snippets-json-ld-opengraph-twitter-tags-schemaorg.html

500 Redirect (Internal Server Error)

ErrorDocument 500 https://www.presta-addons-modules.com/en/seo/prestashop-seo-automatic-google-rich-snippets-json-ld-opengraph-twitter-tags-schemaorg.html

Redirect All Non-Existing Pages to a Custom Page

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* https://www.presta-addons-modules.com/en/seo/prestashop-seo-automatic-google-rich-snippets-json-ld-opengraph-twitter-tags-schemaorg.html [R=301,L]

3. Save and Upload

  • After making changes, save the .htaccess file and upload it back to the root directory of your PrestaShop installation.

4. Clear Cache

  • Go to Advanced Parameters > Performance in the PrestaShop admin panel.
  • Clear the cache to apply changes.

Bonus Tip: Managing Redirects from PrestaShop Admin

If you prefer not to edit .htaccess Manually, you can use an SEO module like SEO & URL Redirect Manager or an SEO-friendly 301 Redirect Module from the PrestaShop Addons Marketplace.

Would you like help with automatic redirects for SEO optimization in PrestaShop? 🚀

About zohaibk

We develop useful addons for #E-Commerce and #CRM software to provide extra features.#PrestaShop,#Magento,#SugarCRM,#Vtiger & #Android #apps
View all posts by zohaibk →