venerdì 18 maggio 2012

How to enable URL rewriting on PrestaShop


PrestaShop is an e-commerce solution known by his many uses through the world. By using PHP and object oriented programmation, it allows to be easily customizable by the common run of programmers, hackers or integrators.

Install mod_rewrite

Before everything, you will have to check if the mod_rewrite module is installed on your Apache. You can see that in a simple phpinfo().
If it is not installed, type (while being root):

a2enmod rewrite

Allow .htaccess files

You will have then to tell Apache to enable the use of .htaccess files, either in the main conf file or in the conf (it is the AllowOverride property which is important):

<directory>
Order Deny,Allow
Deny from all
Options All
AllowOverride All
</directory>

Generate the .htaccess

Once .htaccess are allowed, you can use the tool brought by the Prestashop back office to generate automatically a .htaccess which will indicate to Apache which rewriting rules apply. You will have to previously create the file empty and give it the 666 rights (in the root of you PrestaShop file):

touch .htaccess
chmod 666 .htaccess

Apply modifications and check the logs

Don’t forget to restart apache2 to enable thoses operations:

/etc/init.d/apache2 restart

If you still get some errors or weirds behaviors (like no 404 page loaded, error 500, etc), don’t forget to check the Apache logs before trying anything else, they will tell you a lot about the problem (this path is the default one, yours may be different):

cat /var/log/apache2/error.log

2 commenti:

  1. scusami ma non trovo una tua email, vorrei contattarti per motivi di lavoro, in particolare prestashop, luca mion a@lucamion.it

    RispondiElimina
  2. The blog posted is very interesting from all aspects and it will surely benefit the readers by all means.
    Prestashop Programmer

    RispondiElimina