Enable . htaccess on Ubuntu 14.10, Apache/2.4.10

Asked

Viewed 4,183 times

0

I’m trying to enable the . htacces on Ubuntu 14.10,.

I’m putting the files in the /var/www/

I’ve tried but I can’t seem to make it work.

apache2ctl -S:

VirtualHost configuration:
*:80                   127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

000-default.conf:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/

    <Directory "/var/www/">
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

/etc/apache2/apache2.conf:

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

<Directory /usr/share>
    AllowOverride All
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
  • Tried to sudo a2enmod rewrite && service apache2 restart?

  • Yes, but it doesn’t work... @Guilhermenascimento

  • What appears in the logs? sudo a2enmod rewrite presents some error?

  • it seems all right, the only thing I realized is that by default the root folder is /var/www/html/

  • The return of sudo a2enmod rewrite: Module rewrite already enabled

  • How is the content of your . htaccess?

Show 1 more comment

2 answers

0


Edit:

/etc/apache2/apache2.conf

Remove the "#" comment from the line:

AccessFileName .htaccess

Reboot apache2:

service apache2 restart

  • This line was without the comment

  • If you change the root of the "/var/www/" folder to any other one (/var/www2 for example) and restart, you get an error?

  • I mean, separate /var/www/ from /etc/apache2/apache2.conf with the /var/www/ of 000-default.conf, have any effect?

0

Solution:

At the terminal entering /etc/apache2/sites-available/ accessing the 000-default file I added below: documentroot /var/www

<Directory /var/www/>
  Options Indexes FollowSymLinks
  AllowOverride All
  Order allow,deny
  allow from all

  • Do not use the answer area, for small questions/clarifications use the comments this part below. The stack overflow works different from the structure of a forum, see these differences in the [tour] (http://answall.com/tour)

  • I’m sorry when I tried to comment I was not allowed to give a message that it took 50 points to make the comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.