Symfony 5 – Configuring a Web Server – Adding Rewrite Rules

Symony Docs say:
"The easiest way is to install the apache Symfony pack by executing:

composer require symfony/apache-pack
This pack installs a .htaccess file in the public/ directory"

So far, so good. My Apache is serving the Symfony app; no need for Symfony Local Web Server.
Then they recommend:
"In production servers, you should move the .htaccess rules into the main Apache configuration file to improve performance. To do so, copy the .htaccess contents inside the configuration associated to the Symfony application public/ directory (and replace AllowOverride All by AllowOverride None)"
Do they mean:
1- We have to copy .htaccess content to Apache VirtualHosts configuration and keep the installed .htaccess by symfony/apache-pack.
This works but am I improving performance? Seems like I’m still using the internal app’s .htaccess
Or
2- We have to copy .htaccess content to Apache VirtualHosts configuration and remove symfony/apache-pack.
This is not working for me. Seems like Apache still needs the .htaccess file in the app’s public/ directory.

If correct way to improve production performance is 2, please let me know how to get it to work.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *