How to Set an Expires Header in Apache

Enalbe mod_expires on server
LoadModule expires_module modules/


ExpiresActive On
ExpiresByType image/jpg A31536000
ExpiresByType image/jpeg A31536000
ExpiresByType image/gif A31536000
ExpiresByType image/png A31536000
ExpiresByType text/css A2629743
ExpiresByType text/html A2629743
ExpiresByType application/pdf A2629743
ExpiresByType text/x-javascript A2629743
ExpiresByType application/x-shockwave-flash A2629743
ExpiresByType image/x-icon A31536000
ExpiresDefault A2629743


present a pdf file for download via PHP after checking some rules

First we create a rule on htaccess and redirect the pdf files to a php with its path as query string

The sample code for the pdf-viewer.php.

What is the difference between inversedBy and mappedBy on Doctrine?

  • mappedBy has to be specified on the inversed side of a (bidirectional) association
  • inversedBy has to be specified on the owning side of a (bidirectional) association

from doctrine documentation:

  • ManyToOne is always the owning side of a bidirectional assocation.
  • OneToMany is always the inverse side of a bidirectional assocation.
  • The owning side of a OneToOne assocation is the entity with the table containing the foreign key.

doctrine documentation: