Hello,

I've read tha handbook page on how to have clean url enabled on Ubuntu and a few thread on the subject here. I use Apache locally.

The problem seems to be that nobody has a clear idea how you do it. Some say "edit /etc/apache2/sites-enabled/000-default", others tell you it's /etc/apache2/sites-available/default", and why not /etc/apache2/apache2.conf.

So it's a muddle while there should be one way that works for all Gusty users for instance. There's a video http://www.lullabot.com/files/ubuntuLocalhost.mp4 which deal with Drupal 5 and seems to say that you only need to change one word in /etc/apache2/sites-enabled/000-default and run a2enmod rewrite.

Nothing seems to work for me. :-(

Does someone have a clear idea of what should be done exactly? Your help will be much appreciated!

Comments

Balefire’s picture

Hiya, not sure if this will help but I run a dapper server and find using webmin (sudo apt-get install webmin) far easier to use than editing config files for those servers it is able to work with.

Once installed (assuming you accepted the defaults), go to https://localhost:10000 and enter your username and password. Then go to servers, Apache Webserver, Global Configuration and finally Configure Apache Modules. You'll find the alias module on the left, tick it and click enable selected modules. Worked for me.

Flying (v) - The art of throwing yourself at the ground and missing
Terry Pratchett

libre fan’s picture

Thanks for your message Balefire. I couldn't find webmin in the Ubuntu repos, and googling for it shows it isn't libre software but freeware, then looking it up in FSF directory, it's there. Rather puzzling!

Anyway, I'd rather do without it and learn more about Apache config if I can. :-)
--
Libres-Ailé(e)s (Association for Linux and libre software) (France, Cévennes)

RizSilverthorn’s picture

oops, sorry about that - I forgot to add you need to have the universe repos enabled :)

FYI, this is Balefire - I found my original username & password for Drupal.org (old email server went bang)

David_Rothstein’s picture

I've gotten this to work on Gutsy, and although I don't have step by step instructions in front of me, I seem to remember that there were only two main issues:

  • First is to run sudo a2enmod rewrite (and then make sure to restart or reload Apache so the changes take effect; it should tell you to do that on the screen).
  • Second is that you need to edit the site configuration file to tell Apache to pay attention to Drupal's .htaccess file. This involves editing a file which is most probably either "default" or "000-default" (whichever one you have is the right one to edit), unless you've configured the server in a different way in which case it could be a different file in the "sites-enabled" directory. Inside that file should be a section that looks something like <Directory /var/www/> (or it could be a different directory if that's where your webpage is located). Shortly under that should be a line AllowOverride None. You want to change that to AllowOverride All. You'll also need to restart Apache after that is done too.

I'm pretty sure that was it, but if it still doesn't work for you then post again here. (The key thing is to remember to restart or reload Apache. Any changes you make don't take effect until after you've done that.)

Balefire’s picture

As a followup to this I have set up a development version on my workstation, running from ~/public_html. A few hassles to get it going, but I found that adding the following to ~/public_html/.htaccess sorted it out after following the instructions above:

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteBase /~<username>

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Change <username> to your username. For some reason I had to create the ~/public_access/.htaccess file - I thought this was created automagically? I only figured this out by looking at the /var/www/.htaccess on my works linux server where Drupal is set up to run from the webroot.

Flying (v) - The art of throwing yourself at the ground and missing
Terry Pratchett

David_Rothstein’s picture

Yeah, Drupal ships with an .htaccess file that already contains code just like that (plus lots of other good things too). Not sure why it would have disappeared for you!... sometimes when files get moved around between directories, the files beginning with a "." have a habit of getting left behind, so maybe that's what happened here?

In the general case, it should not be necessary to touch .htaccess to get clean URLs working.

francewhoa’s picture

Same here. The following worked for me. http://ubuntuforums.org/showthread.php?p=7677302#post7677302

Loving back your Drupal community result in multiple benefits for you