I'm running Drupal 7 on CentOS. I have not been able to get the Clean URL test to pass. The rewrite_module is loaded in Apache. I confirmed that the .htaccess file is being used by the Drupal site. How do I figure out why it's still failing? I'm new to Linux and Drupal. I've read articles on the topic, but this has me stumped.

Thanks.

Comments

chunty’s picture

In a way this is not helpful but I had similar problems a while back I and just had to really really really carefully follow the steps for setting up clean urls given on the drupal site here: http://drupal.org/getting-started/clean-urls

Steven P-1’s picture

I am neither new to Linux nor CMS.

Drupal 7 download didn't have an .htaccess file. Who knows what else is hobbled?

heine’s picture

What archive did you use? The 7.22 zip and tar.gz archives on this site do contain a .htaccess. (or, works for me).

rahulbshinde89’s picture

enable mod_rewrite apache from httpd.conf

1. open httpd.conf
2. find mod_rewrite
3. just remove # to enable
4. once it enable then you can run Clean URL
5. this will show check box tick on it and save it

Its working 100%

sosang’s picture

Thanks a lot.
It is a wonderful tip for me.
Great solution it is.

I'm using Wamp.
I opened the httpd.conf file.
Followed the above tip.

The trouble with 'Clean URL Test' has gone.

Now enjoying the Clean URLs(just after check enable the service of Clean URLs).

richaAnkit’s picture

Its not working for me. any other sol. ?

jkingsnorth’s picture

carroll_webprog’s picture

JKingsnorth, the above referenced comment did the trick for me! Thank you.

meenalpatil’s picture

It worked for me :)

kanast’s picture

(using Kubuntu 12.04)
in file 'default' (etc/apache2/sites-available/default)
change for the Directory /var/www
AllowOverride None
to AllowOverride All

ramnar’s picture

Kanast your solution worked in ubuntu.Probably drupal's clean urls documentation should be updated

Anonymous’s picture

were you able to fix it?

rhip’s picture

Try navigating to "/admin/config/search/clean-urls" (remove the ?q= from the URL). It sounds silly but it worked for me.

stattler’s picture

Holy Cow! After spending 2 hours carefully following all the instructions and finding the clean-url test failed, your comment helped!

JoshuaHartmann’s picture

Mate....you get all the internet!
Fixed it for me too :D

Mat77’s picture

Thanks, this tip worked for me too !

Weird behavior though...

heneryh’s picture

What the heck! I've been spending days on this with more system reloads that I can count. Pulled out half my remaining hair.

Anyone know what the underlying cause of this bug is?

RhiannonAmyBuck , thank you!

oplek’s picture

I was banging my head up against a wall until I tried this...

threeg’s picture

This spot on fixes the problem. We knew that mod_rewrite was working, as we could hit urls directly by typing them in, just couldn't hit this settings.

Thanks!

fahadurrehman’s picture

I have almost 100's of Drupal websites on the same server never faced this issue before. Your solution Worked for me.

mattf’s picture

This totally worked for me, too!

bzitzow’s picture

+1

Remove the ?q= from the URL

rabinkmali’s picture

Thank you for the good option, I wasted a day to fix the problem but your suggestion did a magic.

nathalia252’s picture

This really did work for me!!!

mabho’s picture

I swear I try to avoid `me too`, `thank you` useless comments like this one, but I had to post this: THANK YOU!

Ritendra Prasad’s picture

nice trick mate, did work for me

msypes’s picture

Just to let anyone else know, this crazy suggestion still works!

Michael

SolidSnakeGr’s picture

After hours of searching around trying codes, settings, and messing up everything, I found your comment that solved my issue!
Your comment deserves better SEO man, so I'll add these keywords to help others as well :

"How to Enable clean URLs on Drupal"
"The clean URL test failed"

RhiannonBristol's solution worked great!

Try navigating to "/admin/config/search/clean-urls" (remove the ?q= from the URL). It sounds silly but it worked for me.

zack.wd’s picture

THANKS A TON MAN!!! After adding/removing .htaccess,tinkering httpd.conf and basically pulling out all my hair,this fixed everything...Cheers!

fuquam’s picture

I tried everything and this is what did the trick. Thank you!!

Master Splinter’s picture

Can't believe this worked!!!! Amazing!!!!

jkingsnorth’s picture

Oh my good grief, yes this fixed the problem.

This page should totally check if ?q= is in the URL, and if it is , display a different error.

Thank you for saving what's left of my sanity.

+100

graphyte’s picture

Simply, thank you. My head is sore from banging against the wall after reading article after article on this subject. This one simple solution worked like a charm.

stevesirois@gmail.com’s picture

I was about to punch my laptop.... you save my day!!!! and my laptop! :-)

chike’s picture

after getting real worked up about this, ur comment just solved it. thanks so much.

neethu r’s picture

Thanks a lot DaisyMaeH for your comment.. saved me!
That's really a weird behavior, but removing the ?q= from the url /admin/config/search/clean-urls and hitting enter, it showed me the check box to enable Clean Urls and once I ticked it and saved, clean urls started working as required. Earlier it was consistently giving me the Clean URL test failed message with no option or check box to enable clean urls.

designarti’s picture

This has to be a bug. Found it also in Drupal 7.50. Should't happen.

Think. Observe. Think. Conclude. Then talk.
www.globi.ro - just another travel guide

ddarras2012’s picture

After failing with everything else in my Nginx Vhosts, this did the trick!   Thank you.

diwakar’s picture

Try navigating to "/admin/config/search/clean-urls" (remove the ?q= from the URL).

thank you RhiannonPurnell, still works saved me lot of time :)

raedshari’s picture

worked for me!! Thanks

kiran.sanapathi’s picture

I am running Drupal 7 on windows 7. i am unable to run clean URL Test if i run i am getting msg saying that "Clean URLs cannot be enabled. If you are directed to this page or to a Page not found (404) error after testing for clean URLs, see the online handbook". i was enabled mod_rewrite in httpd.conf file. is there any changes need to be made?

keithtoo’s picture

Had the same issue (and solved it). mod_rewrite was enabled, but .htaccess wasn't included in the top level directory. I copied the file from the folder where I unzipped Drupal to the folder I use for my site code and re-ran the check with no problems.

Kase-1’s picture

An new to drupal I have tried coping the .htaccess file but still am failing, hep specify the folder in which to paste the .htaccess file am using a default batika template. Thanks

fjgren’s picture

Hi, mate.
I'm using wamp, for localhost testing of Durpal in win7. I copied .htaccess from durpal folder, to www folder (parent folder for durpal) and it worked. Hope this helps.

rahafrouz’s picture

OMG!!!!!!!!!!!!!!!!!
this worked for me after 2 days dealing with this problem !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thank you dude ;)

abrahaa4’s picture

rahulbshinde89, thanks a lot. Your solution worked!

crystaldawn’s picture

Odd, the /admin/config/search/clean-urls trick appears to work. The question is, why does overlay cause it to break. Is this a bug with overlay or with something else. I didnt see anything in the issue queue about this anywhere and it should be logged as a bug.

Mat77’s picture

I don't think it has anything to do with overlay as I disabled it before and I was still getting the same issue.

D7 looks really buggy...

keti-1931’s picture

thanks this has worked for me.

flashy’s picture

This worked really well for me. Allowed me to quickly solve other issues which were dependent on clean URL's. Thanks

mikeesparza’s picture

I already spend hours and hours trying to make this work, but no luck :(

Already Follow

1. open httpd.conf
2. find mod_rewrite
3. just remove # to enable
4. once it enable then you can run Clean URL
5. this will show check box tick on it and save it

Also Edit the httpd.conf
"Change for the Directory /var/www
AllowOverride None
to AllowOverride All"

No luck either.

Other thing I notice is that the current version of Drupal 7.22 does not include .htaccess And is not that I am not copying it to my server, because I am uploading the entire zip file to my server and unzip it there.

Please help!

mikeesparza’s picture

After doing all that... I decided to download the Dev version (7.x-dev) And this zip do contains the .htaccess so I just copy it to my server and works like a charm!

sajagworld’s picture

Glad it works. But if you are using a mac. Mac tends to hide .htaccess files inside the folder.

ramnar’s picture

1..htaccess file is hidden by default in the installation.You should enable hidden files to see it
2.Please check if you enabled the module mod_rewrite in apache

psorto’s picture

This is the only instance of mod_rewrite in my entire httpd.conf file:

LoadModule rewrite_module modules/mod_rewrite.so

what should I do now?

dougl’s picture

Using Ubuntu 12.04 and Drupal 7.22

With the solution below there was no need for me to create and/or modify .htaccess or httpd.conf. The below solution is also not dependent on each drupal site installed on your server as it allows clean url's globally.

1- sudo a2enmod rewrite

2- sudo nano /etc/apache2/sites-available/default

3- In the above file there are normally 3 entries of the following: AllowOverRide None

4- Change all entries of AllowOverRide None to AllowOverRide All

5- sudo service apache2 reload

Done!

You should now be able to enable clean URL's

Thanks go out to: http://www.ebizontek.com/enable-modrewrite-module-apache-ubuntu for this solution.
Hope it can help someone down the line.

kalidasan’s picture

I tried enabling clean URL using drush and done sudo a2enmod rewrite.

It was enabled. But it was showing clean URL run test is failed.

I just changed "AllowOverRide All" under sites-available.

It was started to work :) Thanks.

Nikrene’s picture

This was the solution to my problem. It worked when only I changed the three lines where AllowOverRide is mentioned (from None to All). Many thanks!

Steven P-1’s picture

Really?

Not worth the trouble for learning this platform when the bozos who maintain it don't even include .htaccess. Who knows what else was left out?

wordpress & joomla work out of the box. This turd comes pre-hobbled.

heine’s picture

What archive did you use? The 7.22 zip and tar do contain a .htaccess. (or, works for me).

guguss’s picture

@Steven: The .htaccess "was / is / will be" available in all Drupal releases !

Try to ask your computer to display hidden files so it will appear...

9tin’s picture

Oh thank u soo muchh
it works 4 me

maxview’s picture

I tried everything: modified the httpd.conf; checked the .htacess, no way to get through, then just type yoursite/admin/config/search/clean-urls, ok, work off.

bufflex’s picture

After trying everything, in the end this is what worked for me. Thanks a lot!

Nickodemo’s picture

It Works.

TWD’s picture

Make sure your site isn't in "Maintenance Mode".

gaurav@mapmytalent.in’s picture

Just only one thing

Open user httpd.conf file in apache server and remove # from this line

LoadModule rewrite_module modules/mod_rewrite.so

Now restart your wamp server.

enjoy.

agenciaq1’s picture

Thank you for the tip.

I had deactivated the Clean URL and I was trying to activate back, but I was receiving the URL test failed.
I was in Maintenance Mode, then I put the site back online and I could activate again the the Clean URL.

Thank you,

ayushmanshrestha’s picture

I followed the steps provided on http://www.dev-metal.com/enable-mod_rewrite-ubuntu-14-04-lts/ and worked!

Activate the mod_rewrite module with

sudo a2enmod rewrite

and restart the apache

sudo service apache2 restart

To use mod_rewrite from within .htaccess files (which is a very common use case), edit the default VirtualHost with

sudo nano /etc/apache2/sites-available/000-default.conf

Search for “DocumentRoot /var/www/html” and add the following lines directly below:

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

Save and exit the nano editor via CTRL-X, “y” and ENTER.

neethu r’s picture

That's really a weird behavior, but removing the ?q= from the url /admin/config/search/clean-urls and hitting enter, it showed me the check box to enable Clean Urls and once I ticked it and saved, clean urls started working as required. Earlier it was consistently giving me the Clean URL test failed message with no option or check box to enable clean urls.

agenciaq1’s picture

Thank you for the tip.

I had deactivated the Clean URL and I was trying to activate back, but I was receiving the URL test failed.
I was in Maintenance Mode, then I put the site back online and I could activate again the the Clean URL.

Thank you,

wizoduwa’s picture

sudo httpd -M | grep rewrite

If you don't see any output, mod_rewrite is not enabled. In that case, you can enable it by running:

sudo a2enmod rewrite
sudo systemctl restart httpd

Check AllowOverride: Ensure that the AllowOverride directive is properly set for your Drupal site's virtual host configuration. This allows the .htaccess file to override certain settings. Open the virtual host configuration file in a text editor. On CentOS, it is typically located in the /etc/httpd/conf.d/ directory and has a .conf extension, such as example.com.conf. Look for the <Directory> section that corresponds to your Drupal site and ensure it includes the following lines:

<Directory "/var/www/html">
    Options FollowSymLinks
    AllowOverride All
</Directory>

sudo systemctl restart httpd

ls -l /var/www/html/.htaccess

sudo chmod 644 /var/www/html/.htaccess

Test Clean URLs: After performing the above steps, try accessing your Drupal site with Clean URLs enabled. If you still encounter issues, you can try accessing the Clean URL test directly by visiting:

http://example.com/admin/config/search/clean-urls/check
  1. Replace example.com with your site's domain. This test will provide more detailed information about any problems with Clean URLs.

By following these steps, you should be able to identify and resolve the issue preventing Clean URLs from working in your Drupal 7 installation on CentOS.