I've spent a long time trying to get clean urls working without success and really need some help.

It started off with not being able to select the clean URL option on the admin page - message being 'Your system configuration does not currently support this feature.'.
I discussed this with my host support and after playing around with .htaccess established that the .htaccess file was being picked up and processed.
I scoured the drupal site for suggestions about what may be wrong, and tried several variations of .htaccess without success.

I then came across a way to 'force' clean URLs to on by adding $conf['clean_url'] = 1; to settings.php. So I changed this, hoping the behaviour may give some clues as to the problem.
The site behaviour with the above line is that the URLs are rewritten - e.g. /?q=admin/settings/clean-urls becomes /admin/settings/clean-urls, but I get a 404 error, file not found.

So, with my next to nothing knowledge about .htaccess and/or clean urls, I'm now guessing that perhaps the actual rules in .htaccess are slightly wrong? Problem is I don't know whats right...

The version of .htaccess I have is the standard drupal version.

Can any technically gifted people point me in the right direction?

Comments

Cool_Goose’s picture

Is your host using Apache ? I think the .htaccess needs to be edited a bit if you use IIS.

yelvington’s picture

The site behaviour with the above line is that the URLs are rewritten - e.g. /?q=admin/settings/clean-urls becomes /admin/settings/clean-urls, but I get a 404 error, file not found.

Drupal is working fine. Your web server is not rewriting URLs from /foo/bar to ?q=/foo/bar. You need to fix the server, not Drupal. It is not a problem with .htaccess. Your webserver may not be reading .htaccess, or it may not have mod_rewrite installed, or it may be some oddball server that has no capability to rewrite requests, or any of a number of other possibilities. Since you didn't identify your server OR your host provider, I doubt that anybody can give you any real help.

cog.rusty’s picture

If the server was running the rewrites contained in Drupal's .htaccess then clean URLs would work even if they were not enabled in Drupal.

The only thing that $conf['clean_url']=1; does is that it makes Drupal use clean URL links in the menus, whether they work or not.

The server requirements for clean URLs are:
- apache mod_rewrite must be installed/enabled in the server
- the use of .htaccess files must be enabled in the server
- Drupal's .htaccess file must be present

Some hosts (but not most) require to edit the .htaccess file and enable the RewriteBase / line, or a RewriteBase /somedirectory line if your site is http://www.example.com/somedirectory

Besides these common cases, there is nothing more to say. It is what yelvington said. Blind troubleshooting is not easy.

szb100’s picture

Hi,

Thanks for the replies. I am indeed using Apache - host is EZPZ (uses cPanel if that has any bearing at all).
I came across http://drupal.org/node/275021 today after more searches which looks relevant to my situation in that I'm accessing the site through a temp URL i.e. http://[IP address]/~[Username].
I did try the suggestions in that post with no joy, and dropped my host another email who suggested that it would work fine once accessing through the proper domain.

So, maybe I should just hold fire on this until I have a proper domain to work under...?