By Anonymous (not verified) on
I've searched the forums and haven't been able to find a solution to this problem, though I've seen it come up in several threads.
My drupal site is hosted on Dreamhost servers, and I cannot get the clean urls feature to work. When I enable clean urls, I get a message saying that mod rewrite must not be turned on. I suspect the problem is with my .htaccess file, but I'm not sure what part I'm missing. Here's my file:
# 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
#added the following 3 lines
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule .* /index.php [L]
#allow access to html in subfolders
RewriteCond %{REQUEST_URI} "/old/"
RewriteRule (.*) $1 [L]
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /223kb
# 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'. originally only one uncommented
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
# allow pass through of stats from dreamost.
RewriteCond %{REQUEST_URI} ^/stats/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/failed_auth.html$
RewriteRule ^.*$ - [L]
# $Id: .htaccess,v 1.66 2005/03/20 19:15:00 dries Exp $If anyone using Dreamhost has clean urls working, I would love to know specifics of your settings.
Thanks in advance,
Dan
Comments
me Dreamhost settings
I have clean URLs working for me, and it *seems* my code is identical to yours. I'm *hoping* you can copy/paste my tested code and enjoy some success on your site.
One thing you might try: rename index.php and .htaccess to something temporarily, then try to load the correct page in the browser. The page will fail, and clear the server cache. Then re-adjust the file names and try again. This has worked for me in the past. here's the v.4.6 .htaccess from my dreamhost sites.
didn't work yet---
Many thanks for sharing your file. I tried what you suggested about renaming index.php and .htaccess, but it still tells me I don't have modrewrite set up.
Something I should have noted in my initial post: I've got path and pathauto modules turned on, and I've also got my site set to run as php rather than php as cgi in the Dreamhost panels.
Any other thoughts?
Thanks,
Dan
Is your site in a directory
Is your site in a directory or in the root? I ask because this line:
RewriteBase /223kb
appears to be wrong unless that is the actual name of the directory you have drupal running in.
in a directory
I'm running 3 sites off a single install in a directory (all 4.6), and I've got a 4.7beta site in the root.
Success!
I got it working this afternoon. I use OS X on my laptop, and so when I downloaded and unpacked the tar file for drupal, the .htaccess file disappeared (OS X hides all files that begin with "."). I discovered a utility (Tinkertool) that allows the user to reveal all hidden files in OS X. Once I did that, I was able to find the original .htaccess, set the rewrite base, and upload. Everything works like it's supposed to!
Not sure why copying and pasting someone else's .htaccess file didn't work.
Thanks for the suggestions!
Dan
Score!
Thanks so much for the TinkerTool tip! I have been pulling my hair out trying to figure out why I'd never seen the .htaccess file on my Mac. Once uploaded (with a tweak to my directory, see below), it worked like a champ! I feel SOO much better now...
/drupal/mydirectoryname/drupalglad it was of use!
glad it was of use!
Worked for me
SpzToid,
Thanks for your .htaccess file. it worked for me .
Live and let live for free community