Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:using_.htaccess_on_ubuntu [2014/06/17 16:46]
Joel Dare
linux:using_.htaccess_on_ubuntu [2020/06/01 22:53] (current)
Line 1: Line 1:
 +====== Using .htaccess on Ubuntu ======
  
 +By default all files under /var/www ignore the .htaccess file.  To fix it, edit the default config file.
 +
 +  sudo vim /​etc/​apache2/​sites-available/​default
 +
 +//Note: Sometimes this directive is in one of the other site files defined in this directory or in the /​etc/​apache2/​apache2.conf file.//
 +
 +In the following section change //​AllowOverride None// to //​AllowOverride All//.
 +
 +<​code>​
 +<​Directory /​var/​www/>​
 + ​Options Indexes FollowSymLinks MultiViews
 + ​AllowOverride None
 + Order allow,deny
 + allow from all
 + # Uncomment this directive is you want to see apache2'​s
 + # default start page (in /​apache2-default) when you go to /
 + #​RedirectMatch ^/$ /​apache2-default/​
 +</​Directory>​
 +</​code>​
 +
 +Also, if you need to use rewrite rules you need to enable them first. ​ You do that with the following command.
 +
 +  sudo a2enmod rewrite
 +
 +Prior to running that command you may get an error similar to the following.
 +
 +  [Tue Apr 14 14:23:34 2009] [alert] [client 127.0.0.1] /​var/​www/​wiki/​.htaccess:​ Invalid command '​RewriteEngine',​ perhaps misspelled or defined by a module not included in the server configuration
 +
 +Finally, don't forget to restart Apache.
 +
 +  sudo /​etc/​init.d/​apache2 restart
comments powered by Disqus
linux/using_.htaccess_on_ubuntu.txt · Last modified: 2020/06/01 22:53 (external edit)