Posted by po3 on July 16, 2007 at 1:02am
I have taken a look at the following page http://drupal.org/node/15365 to figure out to enable clean urls and I'm totally lost. I'm running on a mac OS 10.4.10 with localhost. I guess I have to enable mod_rewrite in apache but have no clue how to locate the .htaccess file. Can anyone help me out?
Comments
mamp?
are you using something like MAMP as your server?
silverwing
www.misguidedthoughts.com
________________________________
MisguidedThoughts
OS 10 Server or Client?
If you're running the server software see this page - http://drupal.org/node/134814
No, I'm not running OS X
No, I'm not running OS X server. I'm just running the normal user version of 10.4.10. I guess that is a client right?
Well, I didn't use one of
Well, I didn't use one of those packages that has everything. Instead, I installed the entropy package of php and installed mysql. Of course apache 1.3 was already running/installed on my mac.
Finder doesn't show invisible files
It might be that you copied or moved everything but the .htaccess file after you downloaded and decompressed Drupal. The Finder doesn't show invisible files (like .htaccess files) by default, and you'll need to use the command line in Terminal to move things around, or use a third-party utility to tell the Finder to show invisible files.
The two utilities I recommend most for this are MainMenu and Tinkertool. Another option is to replace the Finder with another file manager. I've been using Path Finder for a couple years and its advanced features make the Finder look like a toy from Fisher-Price.
so I'm still kind of lost.... sorry
Here's what I have done.
1. found the ".htaccess" file in my drupal directory located in my user folder ("erik_po3") in the "sites" folder in the "drupal" folder
2. opened the ".htaccess" file in textmate and added the following:
# add rewrite module for clean urls
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
uncommented this line "#RewriteBase /drupal" and changed to: "RewriteBase usr/local/sites/drupal" (I was a little uncertain about this path)
Are my steps so far correct? What else need to be done?
hmmmm
I guess I should have asked if you get clean urls on any other package, or if it's just drupal.
Try going into your apache directory (outside of drupal; the apache directory that controls everything) and look for a file called httpd.conf
Open that and look for something like "LoadModule rewrite_module modules/mod_rewrite.so
________________________________
MisguidedThoughts
ok, found the apache
ok, found the apache specific httpd.conf file.
I found this line: "LoadModule rewrite_module libexec/httpd/mod_rewrite.so" and commented it out. The I added this line
"LoadModule rewrite_module modules/mod_rewrite.s" I also noticed that the "AddModule mod_rewrite.c" line was already there. I changed "AllowOverride" to All rather than None. I also changed "DocumentRoot "/Library/WebServer/Documents"" to DocumentRoot "/users/erik_po3/sites/drupal"
After all that I saved it with no luck still. Okay, what else did I do wrong : (
ummm
http://alex.tsd.net.au/cpill/2007/03/08/apache-mod_rewrite-on-mac-os-x/
http://www.ablogapart.org/2005/11/21/enable-mod_rewrite-on-os-x-104-tiger/
Maybe those will help? I just googled "mod_rewrite mac osx apache enable"
~silverwing
www.misguidedthoughts.com
________________________________
MisguidedThoughts
I recommend MAMP
I recommend MAMP because it's ready to go as soon as you download it. It already has mod_rewrite loaded and you should be able to get clean URLs working with no problem with a standard MAMP and Drupal install (provided that the .htaccess file is in the Drupal root).
http://www.lullabot.com/videocast/install_local_web_server_mac_osx
The only downside I can think of when running MAMP is that it has Apache 2 instead of Apache 1.3. Sometimes you'll want the same version of Apache on your localhost as you do on the live server.
I have to second that
I use MAMP and it works like a charm. Never had any issues on it, whether i'm working with drupal or wordpress or habari.
~silverwing
www.misguidedthoughts.com
________________________________
MisguidedThoughts
Thanks guys I'll check out
Thanks guys I'll check out the links. Thanks for all the help!
WoW! I finally got working!
These two links were very helpful. With the two of them I was able to get mod_rewrite working just fine.
http://www.ablogapart.org/2005/11/21/enable-mod_rewrite-on-os-x-104-tiger/
http://alex.tsd.net.au/cpill/2007/03/08/apache-mod_rewrite-on-mac-os-x/
Thanks so much!
silverwing & christefano, thanks for hanging in there with me!
you're welcome
and thanks for reporting back. (That and the thank you made it worth it!)
silverwing - sentimental that way
www.misguidedthoughts.com
________________________________
MisguidedThoughts
That's great
That's great news. Thanks for posting back and letting us know how you did it.
I use this htaccess template
I was lost too with this -using MAMP/OSX- but after several edits and tests I located this htaccess that worked fine in my local server (i think is a standard one for D6) and it did the trick. Maybe could be useful for people to reboot messed-up-beyond-recognition htaccess files:
#
# 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 $