I've just got drupal up and running on a shared hosting account, but the clean URLs function isn't working.

It seems that when I enable it nothing gets written to the .htaccess file and hence the new URL structures don't work.

Any advice aprpeciated.

Comments

xmacinfo’s picture

I had this problem for a few weeks on my hosted CivicSpace site (based on Drupal).

The solution is easy.

In .htaccess, you need to comment out the RewriteBase line.

# Modify the RewriteBase if you are using Drupal in a subdirectory and the
  # rewrite rules are not working properly:
  # RewriteBase /Drupal

What is working on my hosted site is :

# Modify the RewriteBase if you are using Drupal in a subdirectory and the
  # rewrite rules are not working properly:
  RewriteBase /

Hope this helps.

Adam_C-1’s picture

I think perhaps the problem I have is that NOTHING is being written to my .htaccess file. It is completely blank.

I tried adding the bit of code thats working for you, but without any success.

Also, I should clarify, whilst I am on a shared hosting account, I've placed drupal at the root of my domain.

rej@www.dinglicircus.com’s picture

I just upgraded from drupal 4.5 to 4.5.2. Following the instructions to untar the contents of the file to my drupal directory I got a lot of configuration files over written. Following changing the conf.php settings i know have a front page but each link results in a "Not Found" error. Clean URLs seem to be the culprit.

I tried passing the URL to get to the admin settings by hand to switch off Clean URLs. I had a working setup before. What went wrong?

Adam_C-1’s picture

If it is relevent I'm on PHP5

Steven’s picture

As is mention on the download page (in fat, bold letters) and in a gazillion other forum posts on this site, Drupal does not work on PHP5.

Still, your .htaccess file being empty sounds pretty much like the problem. The only 'writing' that should be happening to it is when you upload the file that comes with Drupal. Try removing it from the remote server (remember, most FTP programs hide filenames starting with '.') and uploading it again.

--
If you have a problem, please search before posting a question.

Adam_C-1’s picture

>>Drupal does not work on PHP5

Yes, Steven, I have seen this about. To be honest, I didn't know which version of PHP my host was running until I started playing about with Drupal.

To what extent does this cause problems? Is it worth my time pursing the Drupal configuration whilst on PHP5?

xmacinfo’s picture

Hi!

Drupal simply won't work with PHP5. Not until Drupal 4.6, I guess. Or even 4.7. Who knows. But they are working on it.

URL rewriting works only if your .htaccess file is complete. Drupal ships with a comptete .htaccess file. However, usually the OS hides that file. You might try to open the terminal and use vi to read the file and copy every line to your hosted .htaccess file.

To make this easy, save all the info in a temp.txt file to you hosted server, at the root of your site. Delete the old .htaccess file and rename temp.txt to .htaccess.

Even if your Drupal installation is virtualy on your root, all your pages and the drupal installation is not. Scripts are often referencing to the server path, not the web path.

Steven’s picture

Running on PHP5 will cause a bunch of warnings to appear in some cases, plus several subtle bugs that you might not notice at first, but will certainly mess things up later (this is why our resident troll Carl McDade is still claiming Drupal does work on PHP5, in spite of repeated comments that this is not so).

--
If you have a problem, please search before posting a question.

DKL64’s picture

Here's how I got clean URLs to work :

First, modify .htaccess in the Drupal installation directory. Uncomment RewriteBase and to point to my subdirectory :

# Modify the RewriteBase if you are using Drupal in a subdirectory and the
# rewrite rules are not working properly:
RewriteBase /drupal452

Second, uncomment rewrite_module in Apache2 httpd.conf

# Feb 2005 - uncomment rewrite_module to allow Drupal clean URLs
LoadModule rewrite_module modules/mod_rewrite.so

Restart Apache to reread httpd.conf, and now things are OK.

http://luhman.org