Last updated June 30, 2011. Created by JohnForsythe on May 9, 2008.
Edited by richard_antaki, dman, LeeHunter, pwolanin. Log in to edit this page.
Here are some of the most common reasons why your clean URLs may not be working (assuming you're using a normal Linux/Apache hosting environment).
1. Your site is in a subdirectory, but you didn't set RewriteBase #
If your site URL looks like this:
http://example.com/~jsmith1/drupal/
Then you need to set RewriteBase! Find the section in your .htaccess file that looks like this:
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /drupalAnd change the last line, like this:
RewriteBase /~jsmith1/drupalMake sure you remove the # symbol in front of RewriteBase, otherwise this will not work.
If you move your site later on, this line will need to be changed again. For example, if you later move it to: http://your-site-here.com/ then update the line to RewriteBase / (or just comment it out with a # in front).
2. Your .htaccess file didn't get uploaded at all. #
Check if the .htaccess file was actually uploaded. It should be in the directory where you uploaded Drupal (for example: /public_html/drupal/)
If the .htaccess file is missing, you need to upload it. If you accidentally deleted this file, just download Drupal again, and copy the new .htaccess file.
Make sure the file is only called .htaccess and not htaccess.txt or anything else. The .period .at .the .beginning is required.
This name usually means that the file will be invisible on folder listings on Unix-based systems so you might not always see it. If using an FTP client, you may have to configure it to 'show hidden files'. If listing on the commandline, you must ls -la to see it. This will be somewhat dependent on your OS.
3. Your .htaccess file is corrupt. #
The .htaccess file is very fussy, and only works if things are in a certain order. If you've tried to add password protection or to block image hotlinking (especially if you used cPanel or some other software to set that up), you've probably corrupted the file. The simple solution is to delete your corrupted .htaccess file, then upload the standard version that comes with Drupal.
Evidence of a broken htaccess file can usually be seen in the Apache logs. If you have access on the host, the logs may be at /var/log/apache2/error.log or some variation like that. If you are on a shared host, see your ISPs documentation or helpdesk.
4. Pager and other query strings don't work #
Make sure you have not modified the Apache rewrite rule. The default RewriteRule is:
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]What this rule does is rewrite a path like example.com/node into example.com/index.php?q=node
However, you'd normally then expect that path like example.com/node?page=1 would be re-written into example.com/index.php?q=node?page=1 which would fail since both separators are ?.
However, the rewrite rule has additional flags. The 'L' flag is irrelevant, but 'QSA' makes the difference. What it does is to preserve any existing arguments after the rewrite, thereby changing the second '?' in this scenario into '&'.
Comments
It seems like there should be
It seems like there should be a way for Drupal to check a user's server to make sure that the .htaccess file even exists. If it's missing (as mentioned in reason #2 above) then I'm sure some more novice users would benefit from a message stating that it doesn't exist, and then point them to this page. Right now it's very cryptic when you run the Clean URLs test in D7 with no htaccess file...it does nothing but reload the page when you click run test and doesn't provide any message why.
Matt Stevenson (Stevenson Media)
AllowOverride All
To have clean urls working, also make sure that in the settings of your apache (if you are using apache, /etc/apache2/sites-available/default for example), you have:
AllowOverride Allso mod_rewrite can do its job.
Error 324 (net::ERR_EMPTY_RESPONSE)
Thank you very much, this was part of the WSOD remedy.
In case someone ends up here check http://drupal.org/node/158043#comment-5300544 for a possible/partial solution to your problem.
- - -
whenever you say drupal I shrug
Don't forget mod_rewrite...
I know most of you probably realize this, but particular emphasis needs to be placed on Apache's mod_rewrite module. I use WAMP a lot for my development and unless you have it enabled through the httpd.conf file, your links will constantly return you to your WAMP root location upon being clicked on. To solve this, just go edit your httpd.conf file by left-clicking on the little WAMP icon, hover over the "Apache" menu item, then click on "httpd.conf". Then find the following line inside the text editor that comes up:
#LoadModule rewrite_module modules/mod_rewrite.so
Simply remove that pound sign ('#') and save. Restart WAMP and you're golden. :.)
Hope this helps someone in the future.
Online Infrastructure One Website @ Time
Uncomment /Rewritebase in
Uncomment /Rewritebase in htaccess file, uninstall overlay module (not only disable) and then activate clean urls.
Bons plans du net
WOW! FINALLY!
I had tried EVERYTHING, but this worked!!! THANK YOU!!!
Maintenance Mode
I was in maintenance mode when trying to enable Clean URLs. The clean URL test kept failing. Once I took the site out of maintenance mode, I was able to successfully enable clean URLs.