Clean URLs in Mac OS X Server
Last modified: April 9, 2007 - 11:55
For Mac OS X Server 10.4 (Tiger Server) and most likely previous versions as well, do not make changes to /etc/httpd/httpd.conf expecting the AllowOverride All directive to work. The correct file to add the AllowOverride All directive is in the directory /etc/httpd/sites/. In that directory are the virtual host configuration files. Each virtual server has a configuration file in that directory so it is in those files that you must enable AllowOverride All. If you only have one web server on your server configured, then the file you want to modify is /etc/httpd/sites/0000_any_80_.conf.

Client & Server
This page shouldn't be marked "Server" as these instructions are generic to both the Client and Server versions of OSX.
Your Apache conf is at /private/etc/httpd/httpd.conf
You can stop/start the web server using the Sharing > Personal Web Sharing preferences pane.
Change AllowOverrides in yourname.conf
I'm running 10.5 (not server) and I had to go to /private/etc/apache2/users/myname.conf and change AllowOverrides to All, because I made my web root /Users/myname/Sites in the main httpd.conf file.
Doug Gough
ImageX Media
OSX has both Apache 1.3. and 2.x
As a convenience, Apple installed both Apache 1.3.x and Apache 2.x.
1.3.x is the default (Pref Pane "Personal Web Sharing"), and its conf file is the one at /etc/httpd/httpd.conf
I tried two different things
I tried two different things to see how the various configurations played out. This was done on Leopard 10.5.6.
The first was to run drupal from my home directory (~/Sites, actually), and so I had to modify /etc/apache2/users/username.conf as above. I set "AllowOverride All". Then, the .htaccess located in my ~/Sites/drupal/ directory has RewriteBase set to "/~username/drupal". This let drupal run with clean URLs out of my home directory.
The second location was in the DocumentRoot/drupal location. DocumentRoot is set to /Library/WebServer/Documents, and the main /etc/apache2/httpd.conf file's Directory block has AllowOverride None. Change this to All, and then change Documents/drupal/.htaccess' RewriteBase to "/drupal".
this fixed it for me!
I had a similar situation following some special OS X (not Server) setup using named (BIND) and apache to serve development sites without having to add virtualhosts and edit the /etc/hosts file. The
AllowOverride allwas the missing piece that solved everything for me!file: /etc/apache2/users/username.conf
DocumentRoot /Users/username/Sites/_public
<Directory /Users/username/Sites/_public>
Options Indexes MultiViews FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
<Directory /Users/username/Sites>
AllowOverride all
</Directory>
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
VirtualDocumentRoot /Users/username/Sites/%-1/%-2+/site
</VirtualHost>
More details on my dev machine setup here: A smarter M.A.M.P.
James Wilson
Elementalidad
Fix for 10.5.7 Server
I'm running 10.5.7 Server and dropped this (from jrguitar21) into my site's .conf file and it worked perfectly.
<Directory /path/to/drupal/root>Options Indexes MultiViews FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
Thanks!
Leopard Server Apace 2 Clean URL's Addendum
Phew... That was NOT easy.
First, a bit of background. I'm using Apache 2 on my server, with multiple sites, thus I will NOT be editing my httpd.conf file, but the site specific file. This is often referred to as "Virtual Hosting" .conf file. I've got a fairly standard install, so if you are hunting.. here is where I found mine.
/etc/apache2/sites/00_STUF_THAT_REFERENCES_YOUR_SITE.confNow, when I've read everything about Clean Url's I felt as if I would need to make a number of adjustments to my files. Nope, turns out that for a standard deployment that the mod_rewrite is enabled by default. Oh, and side note, this site's references as to how it should look, are NOT at all like the MAC (with respect to the httpd.conf file. I'm sure you can fine the proper reference some where, but like most programmers, I have ZERO patience, I just want the answer!).
Fact is, all I needed to do was add the following near the top of the virtual host file referenced above.
AccessFileName .htaccess.. Presumes of course you have the standard Drupal .htaccess file in your site's root directory.
Then I restarted apache - hoorah!
ps.
sudo apachectl restart(restarts apache)Scott Baetz
Web Developer
sbaetz@soscs.net
update default apache2 config
Tried to get it to work, but these hints didn't help for me (fresh OSX 10.5.6 install using the apache2 that was included with OSX). rewrite-module is enabled in the default apache2 build that comes with OSX, but during Drupal installation, clean-urls did not become available.
What I did to solve it, was:
1. Edit /private/etc/apache2/extra/httpd-default.conf with
- Add a line to enable rewriting, like this:
RewriteEngine on
2. Configure my virtual host in /private/etc/apache2/extra/httpd-vhosts.conf
- Make sure a -element exists for the documentroot of my virtual-host site, that defines
AllowOverride All
3. Edit /private/etc/apache2/httpd.conf
- Uncomment the line that includes extra/httpd-vhosts.conf :
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
- Uncomment the line that includes extra/httpd-default.conf :
# Various default settings
Include /private/etc/apache2/extra/httpd-default.conf
4. Restart apache2 (sudo apachectl restart)
and things work as expected
Good luck!
Mark Dobrinic @ Cozmanova
the .htaccess file
this worked for me. i added it to the .htaccess file in the same directory it refers to:
RewriteBase /~[user]/ouroakland/htdocs
i am using the defaults "Sites" directory. maybe i should call it a folder since this is a mac?
Mac OS X Server 10.5.8: Server Admin/Allow All Overrides
After two days of CleanURL-experiments on my Mac OS X Server 10.5.8, loads of confusing .conf-files and other strange things, I finally got CleanURLs working with "AllowOverride All" and .htaccess:
1. Skip editing the .conf-files. "AllowOverride All" on the Mac OS X Server 10.5.8 is easily turned on at the servers application (Mac OS X Server Advanced installation): "Server Admin" -> Web -> Sites -> Options -> Allow All Overrides.
2. Uncomment "RewriteBase /" in .htaccess
3. ( Restart "Server Admin" -> Web and ) Drupals CleanURLs are now working.