In PrestaShop, the A .htaccess file is a configuration file used by the Apache web server. It controls how your website behaves without changing the main server configuration.
Common uses in PrestaShop:
- SEO Friendly URLs
Enables clean URLs like:yoursite.com/product-nameinstead of:
yoursite.com/index.php?id_product=1 - Redirects
Redirect old pages to new pages. - Security Rules
Block access to sensitive files or folders. - Caching & Performance
Enable browser caching and compression. - Force HTTPS
Automatically redirect HTTP to HTTPS. - Custom Error Pages
Show custom 404 pages.
Typical PrestaShop .htaccess location:
/public_html/.htaccess
or in your PrestaShop root folder.
Example:
# Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Enable friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
In PrestaShop, the .htaccess file is usually generated automatically when you:
- Enable “Friendly URL”
- Save SEO settings
- Clear cache
Path in admin:
Shop Parameters → Traffic & SEO
Important:
- Wrong edits can break the website.
- Always keep a backup before editing
.htaccess.
