I recently upgraded apache from 2.2 to 2.4.6 and php to 5.5 on ubuntu 12.04 and clean urls arent working anymore (the ?q=node does work though).

I googled and found links asking me to "AllowOverRide all" which i had already done, and some posts suggested changing the lines in .htaccess from "Order allow,deny" to "Require all granted" or "Require all denied", which also i did.

But still Clean URLS are not working.

Any help is appreciated.

Comments

TMDHosting’s picture

You should make sure that mod_rewrite is enabled in your server configuration. It is vital when you are using SEF URLs

Regards

shiv_sms’s picture

mod_rewrite is already enabled.

Clean URLS were working before the upgrade.

I dont know what else to change.

Any help is appreciated.

Thanx

samhassell’s picture

Is AllowOveride set to 'All' in your VirtualHost ?

*edit* nm just read your question properly..

shiv_sms’s picture

this is my 000-default.conf


ServerAdmin webmaster@localhost

DocumentRoot /var/www

Options FollowSymLinks
AllowOverride All


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all denied
# Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all denied
# Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
# Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

shiv_sms’s picture

these are the changes i have done in the .htaccess in the drupal root folder


# Order allow,deny

Order deny,allow
Allow from all


Require all granted

RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

samhassell’s picture

You probably need 'Order allow,deny' as well as 'Allow from all'

Here's what I use:

  <VirtualHost *:80>
    ServerName $site.local.com
    ServerAdmin webmaster@localhost
    DocumentRoot /home/sam/www/$site/docroot
    <Directory /home/sam/www/$site/docroot>
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All 
      Order allow,deny
      allow from all
    </Directory>
    #ErrorLog /home/sam/www/$site/error.log
    ErrorLog /var/log/apache2/error.log
    LogLevel notice
    CustomLog /access.log combined
  </VirtualHost>
Bill Choy’s picture

See https://httpd.apache.org/docs/2.4/upgrading.html for the changes between Apache 2.2 and 2.4

2.2 configuration:

Order allow,deny
Allow from all

2.4 configuration:

Require all granted

Hiking up the Drupal learning developer curve

shiv_sms’s picture

Loaded Modules

core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_expires mod_filter mod_headers mod_mime prefork mod_negotiation mod_php5 mod_proxy mod_proxy_ajp mod_proxy_balancer mod_proxy_connect mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_reqtimeout mod_rewrite mod_setenvif mod_slotmem_shm mod_status

antroxim’s picture

Add to default host config (000-default.conf) these lines:

<Directory /var/www/>
	Options Indexes FollowSymLinks MultiViews
	AllowOverride All
	Order allow,deny
	allow from all
</Directory>
mastermindg’s picture

I had to setup my virtual directory differently:

<Directory /var/www>
        Options Indexes FollowSymLinks MultiViews
        Require all granted
        #LogLevel Debug
	AllowOverride All
</Directory>

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

svinod999’s picture

I had made the required changed in /etc/apache2/apache2.conf, namely incorporating AllowOverride All and Require all granted in section.

My first problem was the drupal folder not loading at all and giving a 404 error on localhost/. My mistake was the place my folder on /var/www instead of /var/www/html. As the DocumentRoot in apache 2.4.7 is /var/www/html, the drupal folder needs to go into the html folder.

Now Drupal was loading, but clean urls were not working. Was solved by the guidance in this post, namely by including the following in /etc/apache2/sites-enabled/000-default.conf

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

Now clean urls are working.

develcuy’s picture

Here you have an excellent HOWTO on configuring Apache 2.4 and php-fpm

https://xdeb.org/node/1613

Just tested tried it, with PHP 7.0 and it works just perfect with clean URLs.