Saturday, June 4, 2016

Apache - Allow htaccess rule on Fedora

When using laravel framework for php, we better use clean URL. For that reason we need to allow .htaccess rewrite so that Laravel will be able to display clean urls.

Open up your Apache configuration file and edit it :
$ sudo vi /etc/httpd/conf/httpd.conf
Change AllowOverride None to AllowOverride ALL within <Directory "/var/www/html"> tag
<Directory "/var/www/html">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride ALL

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
Then restart Apache to reload our new configuration
$ sudo systemctl restart httpd.services
It is not really recommended to edit your Apache configuration file with the above mentioned method but it is good enough for a small project.

No comments:

Post a Comment