Skip to content

Instantly share code, notes, and snippets.

@syn-arch
Forked from dario2994/mod_rewrite_guide.md
Last active January 11, 2022 07:07
Show Gist options
  • Save syn-arch/d93178fe32ff7bb4463c8eda88572a4d to your computer and use it in GitHub Desktop.
Save syn-arch/d93178fe32ff7bb4463c8eda88572a4d to your computer and use it in GitHub Desktop.
Enable mod_rewrite in apache
  • Apache configuration file

    • ubuntu -> /etc/apache2/apache2.conf
    • arch -> /etc/httpd/conf/httpd.conf
  • Add mod_rewrite and .htaccess support for your site At the end of the configuration files add these lines:

    #My site mod_rewrite configuration
    <Directory "/var/www/">
      AllowOverride All
    </Directory>
    
  • Enable mod_rewrite

    • ubuntu: sudo a2enmod rewrite
    • arch: Uncomment, in apache configuration file, the line LoadModule rewrite_module modules/mod_rewrite.so
  • Restart apache

    • ubuntu: sudo service apache2 restart
    • arch: sudo systemctl restart httpd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment