[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Drupal clean urls wont turn off

Posted on 2012-09-01
Medium Priority
Last Modified: 2012-09-07
I just inheriticed a Drupal site.

It has been installed with DB and site and db are talking to each other.

Problem is
a) Site is generating URL's as clean URL's
b) Clean URLs are not working - getting page not found

I have tried setting the clean_url parameter in the variables table from
s:1:"1"; to s:1:"0"; and even to i:0;
No joy

Reading up on clean urls it says that the admin does an auto test to see if your "server supports them". So I did a new install from the same source from new folder to new db. Install was successful but also reports clean urls not supported.

Read the docs - it says to use the default .htaccess file in the drupal distribution - except the code I inherited does not have .htaccess file.

I tried to find where I could download the sample Drupal .htaccess file but my blood pressure became dangerously high when it became apparent that this was not an easy task.

Most solutions talk about going into the admin section - which I cannot do because it is behind a clean url.

Long story short I need
a) A copy of the drupal default .htaccess file AND / OR
b) Some insight in how to turn these clean url's off so I can get this site up.
Question by:Julian Hansen
  • 5
  • 5
LVL 12

Expert Comment

ID: 38357242
I understand the blood pressure. I think I may end up with an aneurysm one of these days.

I don't think this is directly Drupal doing this, and I'd actually start troubleshooting at the Apache configuration. You need to turn off the Rewrite configuration in there. But you're right, the .htaccess is the best place to get the correct configuration.

Depending on the version (6 vs. 7) you can download a fresh copy of Drupal at http://drupal.org/ -- just download it locally and unzip it. Copy the .htaccess file from that into the root directory of your Drupal install (the one containing INSTALL.txt, sites, profiles, etc.).

See if that helps. If not, then edit that .htaccess file and comment out the area that has to do with "Rewrite." I don't think you'll have to do this, though, if you have a good .htaccess in place.

A symptom of not having a good .htaccess is that you can see the main page, but receive a 404 for any other pages in the site, administration pages included.

It's super early in the morning (my standard disclaimer) so if any of this doesn't make sense please do post back and let me (us) know.

Welcome to Drupal -- really, it's a lot easier than you think. :-D

LVL 12

Expert Comment

ID: 38357257
Oh, sorry, just re-read your post, and this is where you can download Drupal 6 or 7, depending on the one you inherited:



LVL 60

Assisted Solution

by:Julian Hansen
Julian Hansen earned 0 total points
ID: 38357305
Thanks Mike,

I was hoping there was a way to get just the .htaccess without going through the whole download thing.

Anyway I wasn't really holding out for that solving the problem. Copied the .htaccess in there and now just getting a 403 Forbidden - telling me I don't have permission to access index.php

Tried adding settings as per Drupal instructions to my httpd.conf - still nada.

After doing the above tried going into test site to see if clean url's now working - nope - so drupal not picking up anything on that score.

Eventually truncated my cache and that sorted out the first problem of why clean urls (although off) were still resulting in clean urls.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 12

Expert Comment

ID: 38357335
A 403 is almost definitely a server issue. If you're on Linux, did you set the permissions properly?

If it's still not working, then my next step would be to take the entire Drupal directory out of the document root and store it in a temporary, but safe place. Then I'd download the clean version from Drupal.org (it's only 1-2MB) and unzip/untar it into the document root.

Since it seems you have access to the actual vhosts configuration (or httpd.conf), just make that a standard configuration with no bells and whistles ... a docroot, a domain (if using name-based virtual hosting), and probably a log or two for troubleshooting. The only real requirement is the docroot.

Then, in the new install, remove the "sites" folder. Then copy (not move) the "sites" folder from the old install (temporary location) into the new install. Restart Apache, etc.

What all of this does is just basically blow away what's in the docroot, replaces it with a completely new codebase/supporting files, and then moves your site itself back in. It also sterilizes the Apache configuration so nothing in there can conflict. This usually solves a lot of problems, and if it doesn't solve it, it rules out a whole bunch of things.

Yes, be sure to clear your cache, if you can get to it.

Again, a lot of this depends on whether you are using D6 or D7, but the general process is the same.

BTW, clean URLs are a good thing. I just had a thought: is mod_rewrite enabled on your Apache server? It's required to do any type of work with clean URLs.
LVL 60

Author Comment

by:Julian Hansen
ID: 38357514
Not Linux Windows - and permissions are not the problem.

It says no permission to index.php but if you go to the site either directly specifying the index.php or simply the docroot path it loads the site fine.

This has to do with clean urls not working properly.

BTW, clean URLs are a good thing.

I agree - not trying to get rid of them - just trying to get this thing up and running so I can see what needs to be done to it. I figure first get it working then get SEF up and running.

Working since I truncated the cache.

Anyway still have the problem on a clean install that "system does not support clean urls" which is nonesense - using it on a several other (non-drupal) sites through .htaccess. The problem here (as always) is the framework does not say why it is not supported and the docs are vague at best.

After going through this http://drupal.org/node/15365 and doing what it says it still does not enable the option in the admin to set clean urls on.

If you have any insights I would like to hear them - otherwise I will close this down as the site is now working
LVL 12

Accepted Solution

junipllc earned 2000 total points
ID: 38357567
I can almost feel your frustration over here. I have contemplated throwing my entire system out of a three-story window, Office Space style, many times. Hasn't happened quite yet. Working in Drupal requires a completely different way of thinking. I always say "Drupal makes the difficult things really easy, and the easy stuff very difficult."

The documentation on that page is mainly for Linux/UNIX running Apache. Some stuff may apply to Windows, but I do not host any Drupal implementations on Windows because there are some things that I do with Drupal that aren't possible using Windows. However, even though I don't personally use Windows to host, most "normal" installs should not cause an issue, so this is a little baffling.

If you haven't found these (documentation exists, a lot of it is just linked to from various places) then check them out:


There are some non-standard hosting setups and troubleshooting information available there that might help to get this solved.

Now, I know the site is working (sort of), but the whole situation makes me nervous. There could be an underlying problem with the fundamental hosting setup that may jump up and bite you at a later date. If you decide to leave it as is, I do suggest that you take a look into it as far as you can when you have extra time (Uhhhh, what? What's extra time?) or hire a consultant to take a quick look at it if your budget allows (again, seriously, extra budget monies?).

I always have one thought at the end of writing each post for some reason so here's one: Check the watchdog report, which is at admin/reports/dblog (or, ?q=admin/reports/dblog for no clean urls) to see if anything pops up in there. Also, the Apache logs can sometimes be very informative if they're in a good mood. :)

Feel free to post back. I'll be in and out today for the holiday weekend, but I'll definitely see if I can offer any other insight when I'm at my keyboard.

LVL 60

Author Comment

by:Julian Hansen
ID: 38357616
Thanks Mike,

Hosting - not hosting dev machine.

Hire consultant - don't think so that is my job - just trying to shotcut the learning curve.

Drupal - had no problems before when I have done the setup - but this was a site mailed as two zips - had no control over the packaging and DB came as a dump.

I will check those posts and get back to you.

Interested to know though

but I do not host any Drupal implementations on Windows because there are some things that I do with Drupal that aren't possible using Windows

What some of those might be - although outside the bounds of the question - interested to know.
LVL 12

Expert Comment

ID: 38357665
No worries, I'm always willing to share my experiences and what I've learned from them.

Originally it was because of lack of support of proper symbolic links. However, I hear that has been (mostly) resolved, and that was back at the start of my Drupal experience years ago.

I know there are more issues than this but I'd have to check my notes. However, it doesn't really matter too much because the main reason I can't host on Windows is that I use Aegir. Aegir is a (really amazing) system for managing one or more than one Drupal instance/server. The real benefit of it is when it's used to manage an entire network of instances/sites/servers/platforms, which is how I host my sites/apps. It doesn't work on Windows, and I don't think there are plans to make it do so. That's a big deal breaker for me.

That's the main reason, although there are some libraries that aren't available for Windows (yet?). Some of my sites use a specialized library or command-line program here and there so that excludes those sites from living on Windows. There is an option to use Cygwin, but that seems counterproductive, and I haven't been able to get it to run reliably for this implementation. Great package, though, if you don't have it.

Like many Drupal developers, I am a Mac user. Despite being a POSIX UNIX operating system, MacOS X can get a little tricky when it comes to hosting Drupal. For development work it's perfect, but for production use I prefer Linux. Plus, I find that the majority of the tutorials and packages available are typically for Ubuntu Linux.

OH, and one more very important issue: many of the cloud providers I use don't support Windows at all. I only have some of my servers in-house with the rest spread across multiple zones and providers in the cloud (overused word). Using Linux lets me diversify and protect my network with more options.

Whatever makes my job easier is good for me. Whatever makes it harder, well I like to look at it positively as a challenge. Unless I end up forcing a laptop or two out the window for impromptu skydiving lessons.

Just for the record, I do not have anything against Windows. I avoid the Mac vs. Windows vs. Linux debates. I just use what is best for my clients, my business, and my sanity :)


LVL 60

Author Comment

by:Julian Hansen
ID: 38359096
Thanks Mike - personally I have a lot against Windows and MS - they owe me about a year of my life lost on nonesense like IE6, configuration mess ups - I could go on but I feel the BP starting to peak again.

I was just interested to know what the shortfalls with respect to Drupal are.

Thanks for your time on this. Points on your way - I might have a question on three as I muddle through this but will open a new question if necessary.
LVL 60

Author Closing Comment

by:Julian Hansen
ID: 38375571
The solution to my problem was that I needed to clear the cache - which is why the site wouldn't "turn off" clean url's (the actual question posed)

junipllc provided extensive information on how to go about solving the issue of getting clean urls up and running again as well as a significant amount of additional information and for that I feel he is deserving of the full points allocation with a grade of excellent (would have graded him higher if I could).

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month19 days, 17 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question