Hello fellow Drupal users,

I am trying to get the Clean-URL feature to work with my distro of Drupal [5.1] - Clean Install [No Database import or anything]!

Here's how my Drupal is setup:

ROOT_FOLDER/somedir_1/somedir_2/somedir_3/_DRUPAL_RESIDES_HERE_

The wierd thing is: I didn't need to make any changes to my .htaccess file.... the clean URLs work just fine AS LONG AS I add a trailing slash.

For example,

If I want to navigate to the blocks section of the admin area, then this would do the trick:
http://mysite/somedir_1/somedir_2/somedir_3/admin/build/block/

[NOTICE THE TRAILING SLASH IN THE ABOVE URL!!!]

However, this would produce the infamous 404 error:
http://mysite/somedir_1/somedir_2/somedir_3/admin/build/block

I have GoDaddy as my host [Delux package]

Please advise, Thank you.

-LR

Comments

linuxRush’s picture

Further note, even after moving the site to just be one level deep, didn't make any difference.

i.e., now I have my drupal set up like this:

http://mysite/drupal_dir

and I modified the .htaccess file accordingly and still no go.

here's how my .htaccess file looks like:

NOTICE THE

RewriteBase /drupal

line.... as my drupal installation is located here... i.e., http://mysite.com/drupal

#
# 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

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# PHP 4, Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1

# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the prefix www. you
# can use one of the following settings to force user to use only one option:
#
# If you want the site to be accessed WITH the www. only, adapt and
# uncomment the following:

RewriteBase /drupal

# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule .* http://www.example.com/ [L,R=301]
#
# If you want the site to be accessed only WITHOUT the www. prefix, adapt
# and uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule .* http://example.com/ [L,R=301]

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

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# $Id: .htaccess,v 1.81 2007/01/09 09:27:10 dries Exp $

Further note, all works well with clean URLs if I add a "/" at the end

Please help.

-LR

linuxRush’s picture

Hi Guys,

I have been working on this relentlessly and made somewhat of a progress...

Before, I was working drupal site off the main domain.... i.e., http://www.mysite.com/drupal

and as a result, when I tried to set up clean URLs, it gave me a 404 page for the clean-URL test.

Then, I pointed one of my domains to this drupal folder, and called drupal that way...

Now, instead of showing a 404 page, it gives me a BLANK page. [I tried viewing page source, but it has none.]

I also messed around with the "RewriteBase /" line.... yet, No further progress so far.

Please advice, as to what I can do next to try and resolve this issue.

Thank you.
-LR

VM’s picture

Are you sure go daddy has mod_rewrite enabled ?

linuxRush’s picture

Hi,

Yes. I called them up personally a couple days ago and they said that mod_rewrite is enabled.

-LR

linuxRush’s picture

bump.

VM’s picture

no idea. have you tried searching the forum with 1and1 as your search term, I'm sure I've seen other posts with people having these same types of issues.
Have you considered leaving 1and1 and finding a more drupal friendly host ?

johnfyoung’s picture

I've been tearing my hair out on this very same problem (i.e., the trailing slash problem) for the passed two days.

Godaddy tech support just told me that if you've got Java Servlet support installed on your site that you'll need the trailing slashes.

So - I disabled Java on my site (I wasn't using it anyway) and it takes anywhere from 30 mins to 24 hours for the change to happen.

I'll let you know if it fixes the problem.

---------------------
jray - Poulsbo, WA

johnfyoung’s picture

OK - so if you have Java enabled for your site, requests for directories without the trailing slash are not resolved. I don't know why. They just don't resolve (it's a Godaddy thing). After removing Java servlet support from my site, I now can use urls without trailing slashes.

This would explain why some folks were able to get Clean URLs to work and some folks not.

Hope this helps.
---------------------
jray - Poulsbo, WA

johnfyoung’s picture

someone asked me to post my htaccess, which I'm pretty sure is the default drupal htaccess, except changing the handler for the .php extension (which defaults to php 4.x on GoDaddy) and the DirectoryIndex entry
-----------------------------------------------
#
# Apache/PHP/Drupal settings:
#

AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

# 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

# Customized error messages.
ErrorDocument 404 /index.php

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

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# PHP 4, Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0

# Requires mod_expires to be enabled.

# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1

# Various rewrite rules.

RewriteEngine on

# If your site can be accessed both with and without the prefix www. you
# can use one of the following settings to force user to use only one option:
#
# If you want the site to be accessed WITH the www. only, adapt and
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule .* http://www.example.com/ [L,R=301]
#
# If you want the site to be accessed only WITHOUT the www. prefix, adapt
# and uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule .* http://example.com/ [L,R=301]

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

RewriteBase /
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_URI} ^(.*[^/])$
#RewriteRule ^(.+[^/])$ http://www.jfyoung.com/$1/ [R=301,L]

#RewriteCond %{REQUEST_FILENAME} -d
#RewriteRule ^(.+[^/])$ $1/ [R]

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Rewrite current-style URLs of the form 'index.php?q=x'.

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

# $Id: .htaccess,v 1.81 2007/01/09 09:27:10 dries Exp $

mattpenner’s picture

I'm usign GoDaddy as well but I do use Java so I don't have the option of turning this off.

If I turn on clean urls I get the blank page after adding RewriteBase /. If I add the trailing slash it works fine.

I have Drupal in a subfolder, however, my domain points directly to this folder. So, the subfolder is the root of the domain.

For instance this is how I have it set up:
/ - root folder for domain 1
/domain2/ - root folder for domain 2. this is where Drupal is installed

http://domain1 - pointed to /
http://domain2 - pointed to /domain2/

I tried to create a rewrite rule to add the trailing slash but it broke my site instead. I may just be doing it wrong. Any help would be appreciated.

Here is my rewrite section in my .htaccess file after my changes (THIS BREAKS THE SITE - DO NOT ADD THIS)

# Various rewrite rules.

RewriteEngine on

# 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/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [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/...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

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

# Edited by Matt Penner 2/15/2008
# Using Drupal at the root folder
RewriteBase /

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Added by Matt penner 2/15/2008
# Rewrite directories to contain trailing slashes (/)
# For some reason simply adding RewriteBase / does not work since godaddy will
# not render the page without a trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1/

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Thanks,
Matt Penner

deric2012’s picture

I finally got clean urls working... turns out I didn't even need the rule RewriteBase / (drupal is in root btw)

My site was developed locally and then uploaded to goDaddy by first disabling clean urls...

Once online, clean urls test failed... read a crapload of forums....

disabled path module, re-enabled path module.

redid clean-urls test... sucess!