Jump to content

Using Friendly URL when .htaccess generator doesn’t work


Recommended Posts

I'm hosting my site with HostGator and noticed that the .htaccess generator wasn't working. I searched the forums but couldn't find an answer so i searched around the internet and found the info below. So i gave it a shot and it seems to be working perfectly. BTW the server i am on runs CentOS Linux.

I found the below article here:
http://prestashop-godaddy.blogspot.com/2009/02/how-to-get-prestashop-friendly-url-url.html

Its been a long and frustrating time for all those who have had a terrible time trying to figure out and get help with the errors occuring after enabling Friendly URL's in PrestaShop. I myself had the same problem for about 1 whole month before finding the answer.

I have taken the time to find out exactly what lines of code to add to the .htaccess file that will work for all webmasters working with a basic install. I was raging so much over this, and I'm sure many of you PrestaShop webmaster's were as well.

I must share this with you because I cannot bear to think of the anxiety that many of you have and are going through. So pay attention. This is very simple!

Put aside all methods everyone else has told you. This is for a standard installation using the Linux hosting packages. I personally use the deluxe hosting and my PrestaShop root is not in the main root of my hosting account, nor is the domain to that root tied to my account. So it doesn't matter where it is. Just as long as your store is up and running and you are waiting to get this over with!


Make your ".HTACCESS" look exactly like this:

# URL rewriting module activation
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !^(TRACE|TRACK|GET|POST|HEAD)$
RewriteRule .* - [F]
RewriteBase /
Options +FollowSymLinks

# URL rewriting rules
RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$2$4 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ product.php?id_product=$1$3 [L,E]
RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ category.php?id_category=$1 [QSA,L,E]
RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ cms.php?id_cms=$1 [QSA,L,E]
RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ supplier.php?id_supplier=$1$3 [QSA,L,E]
RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]

# Catch 404 errors
ErrorDocument 404 /404.php








Now... Yer not done just yet. Make sure you clear your browser's cookies if you dont notice any change. Also go to the sitemap module and update it just to be safe.

The Results should take place as soon as your website says that your settings have been saved. Check your product pages and everything should be alright. With one exception. Some people can't get the proper URL to show up under "Recently Viewed" viewed items. I'm pretty sure you can just add another line in the
ReWriteRule and it should work. But I don't have a need for that so I didn't bother researching.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...