Jump to content

* SOLVED * Friendly URLs product images not working Prestashop 1.3


wildlettuce

Recommended Posts

Hello all! I am trying to get the search engine friendly urls feature to work and it is currently not. It generates the pages and all is fine, except the product images like home, medium, thickbox, etc., don't work, as if the paths are wrong.

 

I have:

1. Turned on friendly urls

2. Generated the new .htaccess file

3. regenerated the thumbs

4. Cleared browser cash

 

It still doesn't work.

 

The problem may stem from the fact that the prestashop folder is not the root directory.

 

From what I understand the problem may lie in the .htaccess file which may need to be edited.

 

Any help?

 

Thanks for your time!

C.

 

Here is the regenerated .htaccess file from the shop folder, below it is the .htaccess file from the root directory:

 

# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution

# WARNING: PLEASE DO NOT MODIFY THIS FILE MANUALLY. IF NECESSARY, ADD YOUR SPECIFIC CONFIGURATION WITH THE HTACCESS GENERATOR IN BACK OFFICE

# http://www.prestashop.com - http://www.prestashop.com/forums

 

 

<IfModule mod_rewrite.c>

# URL rewriting module activation

RewriteEngine on

 

# URL rewriting rules

RewriteRule ^api/?(.*)$ /webservice/dispatcher.php?url=$1 [QSA,L]

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$1$2.jpg [L]

RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$2/$1$2$3.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$2/$3/$1$2$3$4.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$2/$3/$4/$1$2$3$4$5.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg [L]

RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg [L]

RewriteRule ^c/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L]

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

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

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

RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*) /supplier.php?id_supplier=$1 [QSA,L]

RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*) /manufacturer.php?id_manufacturer=$1 [QSA,L]

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

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

RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1-$2$3.jpg [L]

RewriteRule ^([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1-$2.jpg [L]

RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg [L]

RewriteRule ^page-not-found$ /404.php [QSA,L]

RewriteRule ^address$ /address.php [QSA,L]

RewriteRule ^addresses$ /addresses.php [QSA,L]

RewriteRule ^authentication$ /authentication.php [QSA,L]

RewriteRule ^best-sales$ /best-sales.php [QSA,L]

RewriteRule ^cart$ /cart.php [QSA,L]

RewriteRule ^contact-us$ /contact-form.php [QSA,L]

RewriteRule ^discount$ /discount.php [QSA,L]

RewriteRule ^guest-tracking$ /guest-tracking.php [QSA,L]

RewriteRule ^order-history$ /history.php [QSA,L]

RewriteRule ^identity$ /identity.php [QSA,L]

RewriteRule ^manufacturers$ /manufacturer.php [QSA,L]

RewriteRule ^my-account$ /my-account.php [QSA,L]

RewriteRule ^new-products$ /new-products.php [QSA,L]

RewriteRule ^order$ /order.php [QSA,L]

RewriteRule ^order-follow$ /order-follow.php [QSA,L]

RewriteRule ^quick-order$ /order-opc.php [QSA,L]

RewriteRule ^order-slip$ /order-slip.php [QSA,L]

RewriteRule ^password-recovery$ /password.php [QSA,L]

RewriteRule ^prices-drop$ /prices-drop.php [QSA,L]

RewriteRule ^search$ /search.php [QSA,L]

RewriteRule ^sitemap$ /sitemap.php [QSA,L]

RewriteRule ^stores$ /stores.php [QSA,L]

RewriteRule ^supplier$ /supplier.php [QSA,L]

</IfModule>

 

# Catch 404 errors

ErrorDocument 404 /404.php

 

<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/gif "access plus 1 month"

ExpiresByType image/jpeg "access plus 1 month"

ExpiresByType image/png "access plus 1 month"

ExpiresByType text/css "access plus 1 week"

ExpiresByType text/javascript "access plus 1 week"

ExpiresByType application/javascript "access plus 1 week"

ExpiresByType application/x-javascript "access plus 1 week"

ExpiresByType image/x-icon "access plus 1 year"

</IfModule>

 

FileETag INode MTime Size

<IfModule mod_deflate.c>

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE text/javascript

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

</IfModule>

 

 

Here is the .htaccess from the root folder:

 

Options +FollowSymlinks

RewriteEngine on

RewriteRule ^(.*)$ /prestashop/$1 [NC]

Link to comment
Share on other sites

Hello to all of you frustrated friendly URLs product images not working sufferers. I am not really a programmer, but I can skulk my way around files I should not be messing with, and keep backups. The problem was in the .htaccess file, the image paths were regenerated improperly. For example:

 

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /_PS_PROD_IMG_$1/$1$2.jpg [L]

 

Should look like:

 

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$1$2.jpg [L]

 

The product images are in /img/p . So, edit away, but keep a backup! If you erase your file, you will get a white screen front and back end!

 

"Dudette, regular expressions are scum." ~ Bobbus

  • Like 1
Link to comment
Share on other sites

  • 2 months later...

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