Jump to content

SEF URL Customization question


Recommended Posts

Dear Prestashop Community!

 

I would like to change my shop's URL Rewriting pattern for the product.php file.

Like for the CMS pages, I want the url to be like /product/prod_id_url_rewritten.html.

This modification would help a lot during the analization of google anyalitics data.

 

In the .htaccess file, based on the CMS.php line, which is:

RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]

 

I have changed the product line to:

 

RewriteRule ^product/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [QSA,L,E]

instead of

RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [QSA,L,E]

 

Then I also made the neccassary modifiications in the /classes/link.php, the link generation within the site is working fine, but the product.php (when I click on a product link) is saying "product not found".

 

I am using a highly modified version of PrestaShop 1.3.6

 

Please help me.

 

Best regards, Robert

Link to comment
Share on other sites

I found this in the product.php:

 

if (!$id_product = intval(Tools::getValue('id_product')) OR !Validate::isUnsignedId($id_product))
$errors[] = Tools::displayError('product not found');

 

Looks like the 'id_product' GET variable isn't passed to the php file correctly, but i can't see how. Maybe the .htaccess syntax isn't correct?

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...