1

I am currently working on a website, that is built on Prestashop (1.6.1.5 version to be exact). I have a problem with the correct way of setting up If-Modified-Since tag.

I know that in Wordpress in order to set it up, you have to open WP-config file and add

    header("Last-Modified:" . the_modified_date());

But which file should I edit when using Prestashop? And can I use the same line or should I write something different?

Also: I have to edit files in FTP, I cannot add specific modules.

KatGreta
  • 11
  • 5

1 Answers1

0

The command header("Last-Modified:" . the_modified_date()); is adding a Last-Modified line to the http header of the page. To obtain the date it uses the the_modified_date() function that only exists in Wordpress.

You can achieve something of the kind (if your hosting has an Apache server) by modifying the .htaccess file that you should find at the root directory of your Prestashop installation. This file is read by the Apache server every time the server gets a request.

If this is the case, you have to add something before this line:

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

The best place may be right before that line. Add the following:

<ifModule mod_headers.c>
  Header set Last-Modified "Wed, 27 Sep 2017 00:00:00 GMT"
</ifModule>

This change will tag all your http responses with the modified date that you set in the .htaccess file. Not ideal, but it may serve the purpose of informing search engines that you have made changes to your shop.

If this is not what you are looking for, please especify the ultimate purpose of adding a modification date to the http header.

Javier Elices
  • 2,066
  • 1
  • 16
  • 25