Allright, I am so confused. INSTALL.txt says:

"If you want support for clean URLs, you'll need mod_rewrite and the ability to use local .htaccess files. (More information can be found in the Drupal handbook on drupal.org.)"

So, I go looking at the handbook in the only spot that I can find any information about Clean URLs, Handbook->Administrator's Guide->Configuration->Initial Configuration->Clean URLs, and this is what it says:

"... By enabling clean URLs, you will be able to get rid of the "?q=" in the URL and make it "clean." Note that this works only for Apache servers which have mod_rewrite installed. Talk to your web host or consult the Apache documentation for more information."

All I'm looking for is a sample mod_rewrite ruleset that support clean URLs. Everywhere I look it says to look somewhere else. 'Bout to pull my hair out here.
Thanks.

Aran

Comments

The rules that allow clean urls are already present in the .htaccess file distributed with Drupal. Assuming that you are running on an Apache host with mod_rewrite installed (probably likely) all that is needed to enable clean urls is to change the setting on your admin page: http://example.com/?q=admin/settings.

You may need to edit the .htaccess file if running Drupal in a subdirectory. See the comments in .htaccess for details.

--
Bjorn
http://choirgeek.com
because there's no 'I' in ensemble

i just added mod-rewrite to apache config and restarted apache... it loaded ok.
in drupal (cvs), i go to admin/settings and the option to enable clean urls is disabled (cant select option). I edited htaccess to allow for modrewrite... I am in a subdir on this particular installation, and edited htaccess accordingly.

why is the setting disabled for me?

thanks

stay tuned

If the setting is disabled, it means there is something wrong with the Clean URL set up, and enabling the option would cause your site to break. You'd need to do db changes to get back in.

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

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

ah, a safety measure added in cvs.. I been through that detour before....

so, though i setup drupal before I setup the apache mod rewrite.... how do I get drupal to understand its ok now? The module is loaded.

stay tuned

maybe there is a relation... because I also get this error printed whenever I go into settings.
warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: host/servname not known in path/includes/common.inc on line 230.

warning: fsockopen(): unable to connect to projects.ultrastar.com:80 in path/includes/common.inc on line 230.

i think its firewall related....

stay tuned

I had that problem....the setting was disabled, so I put it to enabled. Fuck!, mi site is break. It was a true problem.

OK, I found the .htaccess. It still doesn't work tho. For some reason brining up / brought back a page not found and accessing any pages brought the pages back as if all stylesheets and images were broken. Looks like mod_rewrite is rewriting for all files and ignoring the !-f and !-d rewrite conditions. Anyone have this problem? Temporarly I set my rules to:

RewriteCond /path/to/my/doc/root%{REQUEST_URI} !-f
RewriteRule ^/(.*)$ /index.php?q=$1 [L,QSA]

It seems like the {REQUEST_FILE} env var that is used in the default drupal .htaccess is not being created in my Apache. Here's the options that I configured my 1.3.33 Apache with:

--activate-module=src/modules/php4/libphp4.a \
--disable-module=negotiation --disable-module=actions --disable-module=autoindex \
--disable-module=userdir --disable-module=imap --disable-module=asis \
--enable-module=rewrite

Here's how I got clean URLs to work :

First, modify .htaccess. 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.

David

http://luhman.org

I was having this problem also, but by adding:

AllowOverride All [in httpd.conf, search for .htaccess]

I got it working.

This confused the living daylights out of me, eventually someone told it to me straight, which is how it should be - edit your httpd.conf/apache.conf file and in your vhost section, add the following directive:

<Directory /var/www/htdocs/hosts/somesite.com>
     AllowOverride All
</Directory>

that's all there is to it.

After two days of searching, finally it works.

Thanks for that post icybyte

Michael

Michal

I'm installing/modifying a new Drupal site via Mac OS X. The system hides .htaccess files, so I can't see it on the dl'ed Drupal tarball.

Can someone post a copy of the code the htaccess file contains. I then will find it easy to paste this code into a txt file marked 'htaccess', upload to my root dir, then add the '.' to make it '.htaccess' on the server.

Many thanks

Matt

>> http://visint.tv: V.I.A.
>> http://roamproject.com: mobile video/art

>> http://visint.tv: V.I.A.
>> http://roamproject.com: mobile video/art

Ok, I found the answer by using Mac OS X utility, Tinkertool: http://www.bresink.de/osx/TinkerTool.html

But I'll post the code here for information purposes, so others won't have to enable hidden files, etc:

#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
  Order deny,allow
  Deny from all
</Files>
# Set some options.
Options -Indexes
Options +FollowSymLinks
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Override PHP settings. More exist in sites/default/settings.php, but
# the following cannot be changed at runtime. The first IfModule is
# for Apache 1.3, the second for Apache 2.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal
  # 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]
</IfModule>
# $Id: .htaccess,v 1.66 2005/03/20 19:15:00 dries Exp $

>> http://visint.tv: V.I.A.
>> http://roamproject.com: mobile video/art

>> http://visint.tv: V.I.A.
>> http://roamproject.com: mobile video/art

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

# 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_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 4, Apache 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# PHP 5, Apache 1 and 2.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

# 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

# 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/...)
# uncomment and adapt 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 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 /

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

# $Id: .htaccess,v 1.90.2.5 2010/02/02 07:25:22 dries Exp $

Apache advises here that you avoid enabling .htaccess unless you must.

My alternative was to create a drupal.conf file and put it in my conf.d directory (the typical place where you put extra configuration files to avoid polluting httpd.conf so that upgrades work, etc.) My drupal.conf file has this in it:

<Directory "/www/drupal">
Include /www/drupal/.htaccess
</Directory>

This avoids the issues Apache mentions. And now I can upgrade both Apache and Drupal with no downside.

I'm not sure what I've done here, but it's managed to get the SEF urls workings.

Basically I stripped the htaccess file down to five lines

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

The error 500 server error stopped and SEF urls are working. The original htacces was:

#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<Files ~ "(\.(inc|module|pl|sh|sql|theme|engine|xtmpl)|Entries|Repositories|Root|scripts|updates)$">
  Order deny,allow
  Deny from all
</Files>
# Set some options.
Options -Indexes
Options +FollowSymLinks
# Customized error messages.
ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Override PHP settings. More exist in sites/default/settings.php, but
# the following cannot be changed at runtime. The first IfModule is
# for Apache 1.3, the second for Apache 2.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal
  # 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]
</IfModule>
# $Id: .htaccess,v 1.66 2005-03-20 19:15:00 dries Exp $

I've know idea what all those lines do, but I appear to be able to get the web site working with clean URLs wihtout it. I hope this helps someone because I've been banging my head against a wall with it all day.

I found that this problem was fixed if I added a backslash before index.php?q=$1 right before the close tag.

ModRewrite is enabled by default on the server I'm using. However, I'm unsure as to how to get it working with Drupal's .htaccess file. Here's a link to my service provider's info page

Modifying Apache Webserver configuration?

When I place the unmodified Drupal .htaccess file into my root folder, the administer -> settings -> general settings -> 'Run the clean URL test' does not work, and I get an 'Error 404: File not found' message. So... how do I get this working? What do I need to change in the .htaccess file? I've bee fiddling about with this for a few hours now, and I'm not getting anywhere.

[edit]

Fixed! I used the above code and it now works fine:

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

-----------------------------------------------------------------------
Mondo Erotico
DVD News + the cult films of Borowczyk, Franco, Metzger + Rollin

-----------------------------------------------------------------------
Cult Movie Forums

Thanks a lot vidmarc. You've made my day. I was struggeling with this for a few hours now and all I got from 1and1 was this undecipherable comment:

In Drupal's .htaccess file you might find a statement just above the
Rewrite rules. Now, some web hosters, especially 1&1 Internet, seems to
"hide" the module although it is there.

So to make Clean URLs work in such an environment, simply delete the
line or place a # in front of it to comment it out, look all the way
down and find and delete that to (or palce an # in front of it). ...

They are just useless but thanks for your solution.

Just a heads up to anyone else using iPowerweb hosting, the same trick of commenting out the <IfModule mod_rewrite.c> line makes clean urls work perfectly.

edit: actually, that's the fix suggested by your host, not the one you did. Works like a charm though. Just comment out that one line, and *poof* it works.

I also use 1and1, running Drupal in a subdirectory. I just uncommented the RewriteBase line in .htaccess and Clean URLs seems to be working now.

This was the first thing I tried and it worked!

Also using 1&1 Hosting. Uncomment the #RewriteBase line in your .htaccess and you should be able to Enable Clean URLs. Worked for me!! ^_______^

This worked for me on 1&1 when all other recommendations failed.

Undoubtedly saved me additional hours of frustration.

Any idea why this works?

Thanks for you contributions.

Hi there,

The following lines worked fine for me, now I can use clean URL.

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

BUT when I activate cleanURL in admin/settings all the images on my site disappear !
When I deactivate it, it returns to normal.
Could anybody help on this ?

Many thanks

for me, this does not work on 1und1 (germany).
i am very unhappy about that...

I have two drupal-sites running, being placed into the folder CMS of the basedirectory "www.basedir.de/CMS".
the additional site could be reached by "subdir.basedir.de"

I tried

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

and every single possibility where to put another "/" - nothing helped.

got it.

this helps:

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

lets now try the second site with "subdir.basedir.de"...
wish me good luck!

That's what did it for me. I'm using 1&1 and had drupal in a subdir. So I was trying to access:
http://www.example.com/Drupal-5.16/admin/settings/clean-urls

But in only worked when I modified the standard* .htaccess with:
RewriteRule ^(.*)$ /Drupal-5.16/index.php?q=$1 [L,QSA]

*(note: I also needed the "AddType x-mapp-php5 .php" fix to install drupal)

Thanks headkit!

i was using 1 and 1 and this is the code that worked for me:

#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>
# 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.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # 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
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
  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 /
  # 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]
</IfModule>
# $Id: .htaccess,v 1.82 2007/01/09 09:27:10 dries Exp $

find me at buzz digital

-------------------------------------------------
find me at http://www.steammultimedia.com
-------------------------------------------------

i got it working on 1and 1 with a bit of different code. so hopfully some1 can look at this and find it useful

#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>
# 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.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # 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
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
  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 /
  # 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]
</IfModule>
# $Id: .htaccess,v 1.82 2007/01/09 09:27:10 dries Exp $

find me at http://www.buzzdigital.co.uk/

-------------------------------------------------
find me at http://www.steammultimedia.com
-------------------------------------------------

I've gone through every version of a solution for 1and1 hosting accounts and nothing has worked. I've even tried placing the .htaccess file in the root of my hosted space without any luck. I even tried coping and pasting some of the above .htaccess solutions without success.

I'm wondering if the fact that I'm using a subdomain could be causing me problems. So my domain name goes like this:

subdomain.domain.com

The subdomain URL is being directed to a subdirectory in my hosted space at 1and1. When trying the above solutions I started getting 404 errors, but before I made any changes I was getting 500 errors.

Anyone have any ideas?

Don

I've been using 1 and 1 for a long time now and have tried on numerous occasions for extended periods of time to get clean urls working on my site with absolutely zero luck. My configuration is just in the base folder "/." so my code looks like this

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

I've also tried
RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
and
RewriteRule ^/(.*)$ /index.php?q=$1 [L,QSA]
and
RewriteRule ^/(.*)$ index.php?q=$1 [L,QSA]
and
every other possible combination listed here...
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteRule

I am exhausted.

I follow the codes in .htaccess file. The clean URLs can now be functioned but all the requested pages redirect to the index.php.
I change 'RewriteBase /" to "RewriteBase /drupal6". That is my based path.
Any one can solve me out there? Thanks!

Hi,

I'm setting up a Drupal site for a client on their 1and1 account and had exactly the same problem.
After spending half an hour on the phone to their tech support I found a solution that worked for me.

Simply change the following line:

RewriteEngine on

to:

RewriteEngine ON

Changing the word 'ON' to uppercase seemed to do the trick. I've no idea why, but clean URL's are now working!

Hope this helps,
Joff

1and1 clean url fix

i added this
RewriteBase / (add path to drupal directory if not in base)

after

RewriteEngine on

made it work

This solution works fine for my subdomain! It is appropriate for hosting in Poland at nazwa.pl.

it not working at nazwa.pl

I am having the same problem, for some reason mod_rewrite is not handling the URL's correctly.

The following is the HTML for importing the style sheets:

<link rel="stylesheet" href="sites/all/themes/themname/assets/css/content-vertical.css" type="text/css" media="screen" />
<link rel="stylesheet" href="sites/all/themes/themname/assets/css/sub-content.css" type="text/css" media="screen" />
<link rel="stylesheet" href="sites/all/themes/themname/assets/css/print.css" type="text/css" media="print" />
<link rel="stylesheet" href="sites/all/themes/themname/style.css" type="text/css" media="screen" />

I have the web developer plugin enabled and it looks like it is appending the current part of the site to where the CSS files are at, for example:
http://www.domain.com/admin/settings/sites/all/themes/themename/style.css.

Anyone have any ideas?

Anyone have a .htaccess file fix to enable clean urls on bluehost..?

I still have had no luck..

Any help is appreciated,
Jon Girard

Jon

Jon,
Did you ever get this to work?
I am on Bluehost and have just started my search. If you already found the answer and are willing to share it I would really appreciate it.

If you have not found the answer yet and I find it I will contact you with it.

Tony

Hi There,

Thanks for the reply to my comment, no one really seems to care about blue-host people :'(

I must of spent countless hours going through practically every post there was out there, never did get any of them to work.

Finally I was so exhausted, and had gone past the launch date of my client's websites trying to solve the problem, I just gave up. If an answer to this is ever found, I'll finally be able to get courtenaystory.com & bostondanceco.com running on clean URLS!!

Anyhow, a little while ago a user "erjiang fu" contacted me by email, he was also looking for a fix to bluehost clean URLS. I believe he is also still looking.

Keep our fingers crossed, and please do let me know if you ever find an answer.

Jon.

Jon

I have a drupal 5.7 install. my .htaccess file is exactly like the file that came with drupal 5.7. I have enabled clean urls, global redirerect, path auto. For some reason I have the following code appended to the bottom of standard .htaccess file. My Cpanel is reporting a log error:

Sat Apr 12 23:34:21 2008] [notice] mod_fcgid: call /home/millenni/public_html/index.php with wrapper /usr/local/cpanel/cgi-sys/php5

Here is the code that appears right at the bottom of the .htaccess file.

  # 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]
</IfModule>
# $Id: .htaccess,v 1.81.2.4 2008/01/22 09:01:39 drumm Exp $
Note the following code is extra
RewriteCond %{HTTP_REFERER} !^http://millennialliving.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://millennialliving.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.millennialliving.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.millennialliving.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

My host thinks I really don't need this exta code and suggests using the standard .htaccess code sans the extra code below. I have no idea how the code got there. Please help.

Thanks for looking over

hey i got it
ty

I am Erjiang Fu the one Aran mentioned and had the same problem of enabling clean urls for Bluehost web hosting.

I have just solved my problem today.

In fact, I meant that I have just identified where the problem resulted from.

For me, it was the matter of the understanding of drupal root directory.

I installed my drupal in a subdir, e.g. /public_html/abc

My problems were (maybe problems of Bluehost hosting service):

1. The .htaccess should in the drupal root folder '/public_html/abc' not '/public_html'

2. Then the RewriteBase subdir should be '/' not '/abc' as I thought

My solution:

So my .htaccess file in 'abc' folder has the lines below:
____________________
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
____________________

Conclusion:

1. .htaccess should be in drupal root folder (where you installed your drupal, not the /public_html.
2. the RewriteBase should be '/' because the .htaccess is already in the drupal root folder.

Am I clear here?

Hi Aran, Let me know if you still can not work this out.

Hi everyone:

I'm still having problems with -clean urls- with 1and1 for a subfolder

the code that I'm trying is

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

I've tried it with this variations too:

1) RewriteEngine on

2) RewriteBase /subfolder

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

____________________________________

I've also tried putting the .htaccess file directly on the subfolder but didn't work either.

Any suggestions?

Thank you!

HD

I can enable or disable Clean URL's on my site, but when I enable Clean URL's, some pages don't show header logos. The front page is ok, but when I go to other pages, some it show logos and other don't.

What it could be?.

****
UPDATE

It was only a configuration problem. Now it works fine

I am using 000webhost. i used many cods but no one is working for Clean URLs. If any one knows the .htaccess code for 000webhost so please help me.

People are with you only when they need you

Anyone familiar with Yahoo and .htaccess functionality? I have the code and uploaded the file to the root dir; however, Yahoo will not allow the "dot" for the htaccess ext.? When I attempt to rename ".htaccess", the "dot" is removed. Given that, I can not enable clean URLs. Any work arounds available? Help MUCH appreciated!!!

None of the above worked for me until I found this: http://drupal.org/getting-started/clean-urls
and enabled this:
LoadModule rewrite_module modules/mod_rewrite.so
in httpd.conf