When I deployed magento project from one server to another server css and js didn't loaded. So I google and got this answer which worked for me.

<Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted

sudo a2enmod ssl

sudo a2ensite default-ssl

sudo a2enmod rewrite

sudo service apache2 restart

I used it blindly but I need to know what is purpose of enabling rewrite and these below commands

Options Indexes FollowSymLinks
AllowOverride All
Require all granted

Options Indexes FollowSymLinks

Indexes: A directory content will be listed on browser if no index page. It's not a good idea for security purpose.
So i think you should use -Indexes which will disable indexes so directory contend will not be displayed

FollowSymLinks: It means if there is any symbolic link(Shortcut link) then it will follow the link.

AllowOverride All: It enables configuration override so that your htaccess configuration can override the apache configuration. Means without override your htaccess will not work.

as magento uses symbolic links for static files in developer mode. That's why user don't need to deploy static contend in case of developer mode.

Require all granted: is for enabling all ips to access this service. a2enmod ssl is for enabling apache ssl module so that you can use https

a2ensite default-ssl: this command is for enabling default-ssl site. means you can setup virtual host for port 443 (https) in default-ssl configuration file of apache.

a2enmod rewrite: this command enables apache2 rewrite module, so that htaccess rewrite can work. As you can see in htaccess file of magento there is rewrite added to route all requests to index.php.

service apache2 restart: this command is for restarting apache. apache restart reloads all config so that your changes start reflecting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.