Saturday, September 6, 2008

How to add an Apache directory alias in Mac OS X 10.5 (Leopard)

Another point that I spent a lot of time trying to do was to make an Apache directory alias. The first thing that you have to know is that all directories in the path for the target directory must be with at least permission to read. This was the point that I spent more time. I was trying to make an alias to the directory ~/Desktop/quickstart and the Desktop directory had no read permission for group and others, so that was the problem.
  • You have to edit /etc/apache2/users/{username}.conf and add the following lines:
<IfModule alias_Module>
Alias /your_project /Users/{username}/Desktop/your_project
</IfModule>

<Directory "/Users/{username}/Desktop/your_project">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
<Directory>

  • Save the file and restart apache server.

Thursday, September 4, 2008

How to enable .htaccess in Mac OS X 10.5 (Leopard)

Yesterday I lost a lot of time trying to enable the apache .htaccess file in my macbook. So, I decided to create this post with all information necessary to do it.

  •  You have to edit /etc/apache2/httpd.conf and in the root directory - usually /Library/WebServer/Documents - you have to change the attribute AllowOverride from None to All. Save and close the file.
If you want to enable the .htaccess in your ~/Sites directory, you have to follow the below tips.
  • You have to edit /etc/apache2/users/{username}.conf and modify the attributes Options and AllowOverride as below:
Options Indexes Multiviews FollowSymLinks
AllowOverride All
  • Save the file and restart Apache server.
So, every time that you want to use .htaccess file, you have to modify the Options and the AllowOverride of the directory definition of your application.