Carlos Posted January 20, 2020 Share Posted January 20, 2020 hi, the usual behaviour for an image url is: domain.com/971-thickbox_default/right-image.jpg but in my case and I think is the default behaviour if you change some character or word with the same id like: domain.com/971-thickbox_default/wrong-image.jpg you will see the same image with different url. I do not like this prestashop solution and I want that when a user goes to domain.com/971-thickbox_default/wrong-image.jpg prestashop checks if the title is valid and if not redirect to the right image. One image one url. Someboy knows a solution for this problem? I have searched for a module to solve it but all of them work with page urls not with images. Link to comment Share on other sites More sharing options...
tomerg3 Posted January 20, 2020 Share Posted January 20, 2020 PHP URLs get redirected by a php file, which is why you can easily check the text, and not rely on the ID alone. I believe images only use an htaccess URL, which cannot have PHP code to filter them. You would have to redirect all images to PHP file, which will check the URL, and if it's correct, load the proper image. I don't know if there's a module for that. As long as you do not create links to the wrong URLs, this shouldn't have an effect. Link to comment Share on other sites More sharing options...
Carlos Posted January 21, 2020 Author Share Posted January 21, 2020 My site has a problem with wrong urls for images. That is the beginning of the story. And yes the images url use the htaccess file. Link to comment Share on other sites More sharing options...
Carlos Posted January 21, 2020 Author Share Posted January 21, 2020 14 hours ago, ndiaga said: Hi, What do you call right image and wrong image? My site regenerate all the images every day So sometimes, some id has another item day 20 the right url image was: domain.com/971-thickbox_default/expensive watch.jpg and right image for day 21 is: domain.com/971-thickbox_default/warm-shoes.jpg I want that domain.com/971-thickbox_default/expensive watch.jpg redirect to domain.com/971-thickbox_default/warm-shoes.jpg Only one url for every id. Link to comment Share on other sites More sharing options...
Carlos Posted January 21, 2020 Author Share Posted January 21, 2020 (edited) 3 hours ago, ndiaga said: Did you check in the template how the images are being called? The relation between a product and an image is key => value relation so how can a product load the image of another product? Well, I explain you: the prestashop database is updated every night from other source. So, sometimes some id change. The relation between a product and an image is key => value and is right for today. But it is possible that an old product title is assigned to a wrong id if someone records the yesterdays' url Edited January 21, 2020 by Carlos (see edit history) Link to comment Share on other sites More sharing options...
Carlos Posted January 21, 2020 Author Share Posted January 21, 2020 1 hour ago, ndiaga said: So that update is not being processed correctly. You should fix that. I repeat that my question is about "I want that domain.com/971-thickbox_default/expensive watch.jpg redirect to domain.com/971-thickbox_default/warm-shoes.jpg" Link to comment Share on other sites More sharing options...
tomerg3 Posted January 21, 2020 Share Posted January 21, 2020 I repeat my answer, you would need to redirect all images to a PHP file (in a similar way as all other pages are redirected), which will be responsible for getting the "correct" URL for an image ID, and redirect to that URL. Link to comment Share on other sites More sharing options...
Carlos Posted January 22, 2020 Author Share Posted January 22, 2020 14 hours ago, tomerg3 said: I repeat my answer, you would need to redirect all images to a PHP file (in a similar way as all other pages are redirected), which will be responsible for getting the "correct" URL for an image ID, and redirect to that URL. Yes, I know that is a right solution but I don't know the steps to solve it on this way. Link to comment Share on other sites More sharing options...
tomerg3 Posted January 22, 2020 Share Posted January 22, 2020 While I'm happy to help with general guidance, and specific code questions, if you are looking for development help, I can offer our paid services (message us from our site). Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now