Link to home
Start Free TrialLog in
Avatar of Jason Watkins
Jason WatkinsFlag for United States of America

asked on

Clean URLs in Drupal

Hello,

I am trying to enable clean URLS in my Drupal (6.22) install. The option to enable the setting is greyed-out. The instructions for fixing this on Drupal's site do not even come close to what I have (no exaggeration). I did a default install of Drupal 6.22 from the ubuntu repositories on server 11.10. I am using a .local domain behind a NAT if that matters.

TIA
Avatar of Anuroopsundd
Anuroopsundd
Flag of India image

Firebar,

The cleanurls page tries to connect to itself using the exact same server, but with a clean url structure. The only reason it would be greyed out is if your server does not support mod-rewrite on your account.

Things to check:
1. That you actually have mod-rewrite installed (you are using apache, right?)
2. That your global apache config allows overrides in your vhost
3. That your global apache config has not overridden the .htaccess file to be some other location
4. That you actually have the Drupal .htaccess file still.
Avatar of Jason Watkins

ASKER

Hello,

Thanks for the suggestions

How do I confirm that my global apache config allows overrides in my vhost?

That my global apache config has not overridden the .htaccess file to be some other location

That I actually have the Drupal .htaccess file still.

 Anuroopsundd,

Did that... That tutorial couldn't be any more different from what I have.
Part of apache2.conf


  GNU nano 2.2.6                    File: apache2.conf                                              

Include mods-enabled/*.conf

# Include all the user configurations:
Include httpd.conf

# Include ports listing
Include ports.conf

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/

#Server name
ServerName drupal
Can you please post your site specific config file? I am looking for everything within the virtualhost directives
Sure. Where should I look for that?
In the apache sites-enabled folder
Maybe this is it?

root@server:/etc/drupal/6# find / -name 'sites-enabled' -type d
/etc/apache2/sites-enabled
root@server:/etc/drupal/6# cd /etc/apache2/sites-enabled/
root@server:/etc/apache2/sites-enabled# ls
000-default
root@server:/etc/apache2/sites-enabled# less 000-default

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

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

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride All
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        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/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
A few more questions:

1. Can you confirm that apt installed drupal in to /usr/share/drupal6/

2. Can you provide an ls of /etc/apache2/mods-enabled/

3. Can you provide an ls -las of /etc/apache2/conf.d/
This is what is in /usr/share/drupal6

n74jw@server:/usr/share/drupal6$ ls
cron.php  index.php    misc     profiles    scripts  themes      xmlrpc.php
includes  install.php  modules  robots.txt  sites    update.php

n74jw@server:/etc/apache2/mods-enabled$ ls
alias.conf          authz_groupfile.load  cgi.load      drupal.conf       negotiation.load  rewrite.load
alias.load          authz_host.load       deflate.conf  env.load          php5.conf         setenvif.conf
auth_basic.load     authz_user.load       deflate.load  mime.conf         php5.load         setenvif.load
authn_file.load     autoindex.conf        dir.conf      mime.load         reqtimeout.conf   status.conf
authz_default.load  autoindex.load        dir.load      negotiation.conf  reqtimeout.load   status.load

n74jw@server:/etc/apache2/conf.d$ ls -las
total 24
4 drwxr-xr-x 2 root root 4096 2012-04-14 21:08 .
4 drwxr-xr-x 7 root root 4096 2012-04-14 21:08 ..
4 -rw-r--r-- 1 root root  269 2012-02-14 12:53 charset
4 -rw-r--r-- 1 root root 3296 2012-02-14 12:53 localized-error-pages
4 -rw-r--r-- 1 root root  143 2012-02-14 12:53 other-vhosts-access-log
4 -rw-r--r-- 1 root root 1424 2012-02-14 12:53 security
When you installed Drupal, it looks like you missed an important step from the readme (this is the source file from the distro: http://anonscm.debian.org/viewvc/pkg-drupal/branches/drupal6/debian/README.Debian?view=markup)

Step 3 reads:
3. Enabling access in Apache
----------------------------

Since version 6.20-1, drupal is not enabled by default in Apache 2. To enable
web access to the drupal application, simply link the /etc/drupal/6/apache2.conf
in /etc/apache2/conf.d/drupal6.conf with this command:

  ln -s /etc/drupal/6/apache2.conf /etc/apache2/conf.d/drupal6.conf

Without this, the correct "AllowOverride" directive for the Drupal directory is not loaded in to Apache and thus the mod-rewrite commands in Drupal's .htaccess (which are used for clean urls) are ignored.

Once you add that symbolic link and restart apache, things should work fine assuming no other issues.
I did a cp of the above step, not a link. Could that make a difference?
If you copied it, it clearly isn't in your apache2/conf.d folder. Either you didn't have the right permissions at the time or you copied it in to the wrong folder.

So yes, I should say there was a difference. Also, use the sym link instead of copying it. That why if/when the ubuntu package gets updated, the correct version gets included when apache loads.
After that change, I cannot see any web page from that server.
ASKER CERTIFIED SOLUTION
Avatar of stephencolson
stephencolson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I appreciate your help. I am going to try this install on a clean server without using the ubuntu packages from the repos. Given all the time invested thus far, it is now starting to be come wasteful.

Thanks