I recently installed drupal 7 rc2.
Everything works fine except my Clean URL's. I followed the guide as described on drupal.org but when I do the Clean URL test nothing happens and there are no options to turn them on or off.. Can anybody please help me?

Comments

sammyman’s picture

You need to copy the .htaccess file over to your server too. Just happened to me too.

bwout’s picture

I did it! thanks for the reply. The error come out of the .htaccess file.

SseggembeMoses’s picture

This worked for me. thanx man

laurentiu86stan’s picture

I'm having the same problem and the .htaccess file was copied fine...still the same problem...

lugovsa’s picture

I have made an upgrade from 6.20 to 7.0 (Apache on GoDaddy, may they have their servers in their homes :) ). No button for turning on Clean URLs appears on "...admin/config/search/clean-urls". The only buttom present is "Run The Clean URL Test" which returns you back to the same page. I tried to re-upload to the remote server a fresh copy of .htaccess, uncommented there "Rewrite Base", which used to help with Drupal 6. Nothing worked.

Dear kind fellows, please be even kinder and bring me back my "Clean URLs" button!!! :(

EdgeDude’s picture

I'm having the exact same problem with trying to enable Clean URLs.

After navigating (.../Configuration/Search and metadata) and hitting the button "Run the clean URL test". My screen just flashes and the exact same screen appears. I see no results of the test and I have no boxes to check (or uncheck).

EdgeDude’s picture

OK - here's how I fixed my problem.

I read http://drupal.org/node/15365 very carefully and realized I need to change my .htaccess file

It turns out my .htaccess file was empty (not sure why), so I downloaded from

http://drupalcode.org/viewvc/drupal/drupal/.htaccess?view=log&pathrev=HEAD

and now I have a check box for enabling Clean URLs and I check the box and how it all works.

Hope this helps others.

marco_saysource’s picture

Since the link posted by EdgeDude no longer works, I thought it could be of interest for other people looking for the solution to this problem have a new (working) link:

http://drupalcode.org/project/drupal.git/commit/fdc91796bfc2da4baae1dae1...

Marco

woop_light’s picture

the working link solved everything for me (working on wamp).

TransitionKojo’s picture

Thanks Marco! I just DL'd this .htaccess file and put it on my server. Once I re-ran the test, I got the Clean URLs checkbox.

Yea Drupal community docs!!

peter.thorndycraft’s picture

Thank you so much, this was where I got stuck.

Peter

suhailanwar’s picture

Hi
I was having the exact same problem with my site. then i checked this link given on the popup for clean urls in drupal 7. i read all the information and then got to know that i will have to enable Apache mod_rewrite on my local server. this was the solution i was looking for.
so enable the mod_rewrite of apache on your server to get rid of this problem

klidifia’s picture

This fixed it for me, running WAMP.

Sebbon’s picture

Ran into the same issue here. Nothing helped. Not even all of the modifications to HTACCESS file.
Finally i reset the htacces file to default. Uploaded and went to the clean urls activation page. Still the same result after clicking on the test button. Then I thought, why not manually remove the '?q=' part from the url and see what happens?

Voila! Manually entering "admin/config/search/clean-urls" instead of "?q=admin/config/search/clean-urls"
got me to the page but now with the checkbox! One check and save and all is ok now.
Still can't seem to understand why it dod not go to the right url itself though...

rafhuys’s picture

thanx!

capulux’s picture

Worked for me, too :)

rwt’s picture

You saved my day ! Thanks !!!!!

petersmeekens’s picture

This worked for me too, thanks!

watbe’s picture

thanks too!

lifepillar’s picture

@Sebbon: thanks, that fixed it!

ciderpunx’s picture

@Sebbon

You are a genius. I was thinking I'd have to do some gnarly hack in the variables table to make that work. Many thanks!

frigginbone’s picture

After several hours of wasted time, I found your solution. Worked great, problem seems to be solved.

Thank you!!

watman’s picture

Your solution worked for me! Thanks Sebbon!

ryan.gibson’s picture

I could kiss you... but I'll just say thanks.

rtrombetta’s picture

This was the only thing that worked.

Luca Cattaneo’s picture

thanks a lot!! it works!!

thunt’s picture

Thank you!

Meg Ben Nun’s picture

Worked for me!!!! great solution!! [=

kentjames1980’s picture

@ sebbon, worked perfectly on Drupal 7 using easyspace as a host - this may help someone in the future! thanks

grahamvalue’s picture

This is what worked for me too.
No idea why.

But I had to make the /index change before this worked.
Also made the RewriteBase change even though it didn't seem necessary.

Also, note that htaccess changes are not hacks.
They are explained in the clean urls handbook here - http://drupal.org/node/15365

XaviP’s picture

Thank you! This save me !!

VanessaR’s picture

Thank you @Sebbon! It works for me too!

cj3wilso’s picture

This worked for me.. thanks!

srikanth.g’s picture

I can see only "Enable clean URLs" checkbox,where is the button "Run the clean URL test" ? in my drupal 7.31

Jaypan’s picture

If you see the checkbox, the test has already been passed.

srikanth.g’s picture

Ok..that means If there is any problem with server(apache/iis) configuration then only the button "Run the clean URL test" will appear? otherwise directly "Enable clean URLs" checkbox comes,right?
My site is running on IIS,drupal 6.14,i am not able to enable clean urls,no cron also.I guess htacess file not read by iis,what is solution?
shall i upgrade drupal to latest(6.33)?

Jaypan’s picture

If you were on an Apache server, I would say yes, but actually I don't know anything about Microsoft servers or IIS so I can't tell you if it is the same or not.

spongeyxx’s picture

After reading the comments I focused on the .htaccess file and realized that on my server the .htaccess file actually had a .txt on the end of it. I removed the suffix so it went from ".htaccess.txt" to ".htaccess" then went back to the clean url page and the check box was there!

I hope this helps out. This may be happening if you used "Simple Scripts" from your Cpanel to install Drupal.

-Vic

SKap’s picture

Hit the nail right on the head. Combined this suggestion with @Sebbon and there was a happy little checkbox. Thanks!

marcopanichi’s picture

and it will work!

origo’s picture

Another possible reason why you don't see the checkbox is if you have installed Drupal 7 in a subdirectory. I had to edit the .htaccess file and set RewriteBase before the checkbox would appear. For example, if Drupal is installed in "http://www.example.com/d7/", then in .htaccess you need to set:

RewriteBase /d7

(see the comments in the file).

lugovsa’s picture

Thanks for the comments. In my case, that was none of the above. As I moved to another hosting (from GoDaddy.com to JustHost.com), the problem has been solved by itself. Therefore, the server options were not correct and I had no access to change them.

eduardoarantes’s picture

That is what was preventing me to get it to work

jtpalette’s picture

Thanks! This one did it for me as well! :)

parksan’s picture

Many thanks, save my much time, from 2:00pm to Now(22:30pm) today to figure out this problem. finaly, done here.

my D7 is subdirectory,
find the .htaccess file in D7 root, and open it,
find the "# RewriteBase /drupal" in codes, delete the "#", change the "drupal" to your file's name: my file is "blog",
"RewriteBase /blog" - the end change to this.

apriebe’s picture

I was still having problems getting clean URLs working after trying advice suggested above. In my case, I had to edit the Apache (2.2.17) httpd.conf file and in the "Directory" directive for my DocumentRoot, I had to change "AllowOverride None" to "AllowOverride All". After restarting Apache I was then able to enable clean URLS.

Andrew

grip media’s picture

This solved it for me. Was about to pull my hair out. Thanks!

michaelscappa’s picture

Had this same issue, same resolution. How this ends up in production, I don't know...

smith02’s picture

Hello all,

I'm preparing my fresh install of drupal 7 and
this problem occur.
But editing my "/etc/apache2/sites-available/default"
from AllowOverride None to AllowOverride All
under the Directory directive solved the problem.

Thanks to apriebe.

rohnjeynolds’s picture

If you're having this problem, make sure your Apache VirtualHost definition includes an "AllowOverride All" directive in the Directory definition. Something like this:

<VirtualHost *:80>
    ServerName mydrupalsite.com
    DocumentRoot /path/to/drupal/docroot
    <Directory /path/to/drupal/docroot>
        AllowOverride All
    </Directory>
</VirtualHost>

This will allow Apache to respect your .htaccess file's directives.

WeGG’s picture

I am a noob.
Where do I place that code, or where do I find it in a file, and where do I find the file?
thank you.
Also, are this fixes on local machines?
I am hosting with 1and1, and would like to know how to fix it there.

xhang’s picture

Change
RewriteRule ^ index.php [L]
to
RewriteRule ^ /index.php [L]

somanyfish’s picture

This worked for me to, on a site hosted by 1and1. For this site, I needed to add this to my .htaccess, so that the server would use PHP5 instead of the v4, which is the default:

AddType x-mapp-php5 .php   

I was worried that was messing up my .htaccess file, but your suggestion did the trick. Thanks!

jhofer’s picture

after trying all the other solutions... the slash before the index worked for me. Thanks! I'm with Bluehost...

axeloi’s picture

Solved!
Thanks a lot!

Mirfster’s picture

I host multiple sites using GoDaddy. All of my sites are under SubFolders, so here is how I easily corrected the "Clean URLs" issue.

1) In my SubFolders, I editted the ".htaccess" file and uncommented the "# RewriteBase /". So it now simply looks like "RewriteBase /" (without the quotes of course...)

*** If you do not have the ".htaccess" file in your SubFolders, simply copy and edit the default one the comes with the Drupal installation.

2) I then used a "clean url" to get to the configuration page: "http://MyWebSite.com/admin/config/search/clean-urls" instead of "http://MyWebSite.com/?q=admin/config/search/clean-urls".

3) Enable the CheckBox and Save.

Keep in mind that if you do an update (like 7.0 to 7.2), you want to make sure that you don't overwrite the ".htaccess" file.

Best of Luck!

juroon’s picture

I had clean URL's turned on, but they went away with my update to 7.2. I did not overwrite my .htaccess file in the process. I was not able to re-enable by going through the admin menu, but when I went directly to admin/config/search/clean-urls as suggested above, it worked.

I don't know if it will hold, but it's great for now. Thanks!

slater101’s picture

ok the way I fixed it for me with drupal 7.4 was by re downloading drupal, got the full drupal install so I could get the .htaccess file then replaced my faulty file with the proper one..

This time when I redid the check test there was a button to enable clean urls :-)

Oh happy day. thanks for all your help guys

slater out.

AshleeSP’s picture

I had the exact same issue and you're solution helped me out (on godaddy hosting)!

Thank you so much!

kbro50’s picture

This is exactly what I had to do after installing Drupal 7

McSukkelaar’s picture

Thank you very much! This was exactly what i was looking for.

Jawi’s picture

The solution discribed here worked for me with an multisite install.

admin/config/search/clean-urls


Practice what you preach >> www.jawi-online.nl >> Full service internet bureau >>

the daily orbit’s picture

my solution was even easier, I just extracted a copy of Drupal on my desktop, and uploaded the .htaccess file in it to my server. Worked just fine for me after that.

snowmountain’s picture

I tried pretty much everything in the posts above, and though I am sure they worked for some people, nothing worked for me - until I tried this

In .htaccess, replacing

RewriteRule ^ index.php [L]

with this

RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]

I was running Drupal 7 in a sub directory, which is where the .htaccess file I modified was. (I had experimented with the .htaccess file at doc root also, to no avail.)

toninoni’s picture

Yes! That's it, just created an account to thank you. Man, I love you!

islalobo’s picture

there are two sites on our server
public_html/site1/drupal
public_html/site2/drupal

site1 is an old site that we are working to migrate over. site2 is the drupal site I am working with. updated drupal core located in
public_html/site2/drupal

encountered this problem....when I navigate to
admin/config/search/clear-urls

I get directed to the home page of the old site.

thelonelyghost’s picture

+1 for the bug. I eventually found out how to turn it on (Ubuntu + Apache2 help), but some notification of failure would be appreciated. As a UX developer trying to learn Drupal, I can easily see how confusing this makes things for the average newbie.

Not familiar enough with the Drupal API to submit a patch, but you have my moral support.

Edit: Discouraging that my first post on drupal.org is bug-related...

vivdrupal’s picture

The Godaddy solution by Mirfster (above) works.

BenjaminRH’s picture

None of these things worked for me, but I eventually found this solution:

In your .htaccess file, replace : RewriteRule ^ /index.php [L]
with: RewriteRule ^ /?q= [L]

Cheers!

akki123’s picture

Hi

In apache error log file, I was getting this error

"order not allowed here"

I added this in my apache configuration file


AllowOverride FileInfo Limit Options Indexes

and restart apache.

Note: I got this solution from here http://devtime.blogspot.com/2008/02/htaccess-order-not-allowed-here.html

Drupal version is 7.9

Thanks

akki

vonGunther’s picture

the solution changing RewriteRule ^ index.php [L] to RewriteRule ^ /index.php [L] worked for me thanks guys

dark_kz’s picture

So is there any way to enable 'clean_urls' in database `variable` table?

21plus79’s picture

If your server is running on Apache make sure you have the '.htaccess' file present on your server. If it's not there simply create an '.htaccess' file and load it in the same directory where you have Drupal installed. Name it .htaccess (with a dot in front as oppose to htaccess or .htaccess.txt

The '.htaccess' file should contain:

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

If this is all in place then just go to Amin > Configuration > Clean URL and test and Enable this feature.

Dollowmite’s picture

I'm having this issue as well. I've tried change htaccess file as stated multiple times and with different code, all with no luck.

I have no idea what to do. I have no check box and when I run the test, it says failed any help would be great. Thanks in advance.

zeta1600’s picture

You have got to try this answer from "above." It's a miracle! https://drupal.org/node/1002832#comment-4182496

Eranga’s picture

This is the .htaccess content worked for me.

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.

Order allow,deny

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php

# Force simple error message for requests for non-existent favicon.ico.

# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Override PHP settings that cannot be changed at runtime. See
# sites/default/default.settings.php and drupal_initialize_variables() in
# includes/bootstrap.inc for settings that can be changed at runtime.

# PHP 5, Apache 1 and 2.

php_flag magic_quotes_gpc off
php_flag magic_quotes_sybase off
php_flag register_globals off
php_flag session.auto_start off
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_flag mbstring.encoding_translation off

# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On

# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600


# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off

# Various rewrite rules.

RewriteEngine on

# Block access to "hidden" directories whose names begin with a period. This
# includes directories used by version control systems such as Subversion or
# Git to store control files. Files whose names begin with a period, as well
# as the control files used by CVS, are protected by the FilesMatch directive
# above.
#
# NOTE: This only works when mod_rewrite is loaded. Without mod_rewrite, it is
# not possible to block access to entire directories from .htaccess, because
# is not allowed here.
#
# If you do not have mod_rewrite installed, you should remove these
# directories from your webroot or otherwise protect them from being
# downloaded.
RewriteRule "(^|/)\." - [F]

# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (http://example.com/... will be redirected to http://www.example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (http://www.example.com/... will be redirected to http://example.com/...)
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
# RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
#
# If your site is running in a VirtualDocumentRoot at http://example.com/,
# uncomment the following line:
# RewriteBase /

# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]

# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.

# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

# Serve gzip compressed JS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteCond %{REQUEST_FILENAME}\.gz -s
RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

# Serve correct content types, and prevent mod_deflate double gzip.
RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]


# Serve correct encoding type.
Header append Content-Encoding gzip
# Force proxies to cache gzipped & non-gzipped css/js files separately.
Header append Vary Accept-Encoding


# $Id$

DiviNe187’s picture

I thought i would add a comment here cause i feel this will be helpfull for more people scratching their heads on this problem.

I had clean urls enabled, i disabled them to see some pathing on some nodes, and when i tried to re-enable the clean urls the whole checkbox was gone and as you can guess, it said the test failed and i was unable to run clean urls on the server while a minute before that it ran perfectly.

Fortunately i came to a quick understanding (might be the coffee) of what probably the cause would be for not being able to re-enable it.

Turns out that if you disable clean urls while in maintenance mode, you, or at least i could not turn it back on untill i turned off maintenance mode. When i turned it off, i refreshed the clean urls page and gave me back the checkbox.

I hope this helps anyone before scratching the surface of his head off why they cannot re-enable it when it worked just a few min ago.

Kevin

WendyWJ’s picture

DiviNe187, this is my case! You are a star!

eetdcob’s picture

Thank you for sharing this, it was the answer to my problem.

surendra77c’s picture

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


AllowOverride None # modify this line to AllowOverride All