Written by Guillermo Garron .
Date: 2013-05-03 17:05:00 +0000
Using your Mac for development of web applications or websites, is very easy as it already comes with Apache pre-installed, the problem is that .htaccess file does not work by default.
But it is easy to enable it.
First some changes in the main configuration file of Apache.
sudo vim /etc/apache2/httpd.conf
The first thing I will do is to change the Document root from the default /Library/WebServer/Documents to my Sites folder under my home directory.
So, look for these lines:
And change them to:
Of course instead of your-username insert there your real username.
I prefer to have it there, as I do not need root permissions to add content to that folder.
Enable .htaccess file in Mac OS X
In the same file, under the section
<Directory "/Users/your-username/Sites"> look for:
- AllowOverride None
And change it to:
- AllowOverride All
Also edit this file:
sudo vim /etc/apache2/users/your-username.conf
And look for the same line AllowOverride None* and change it to AllowOverride All
Then restart apache:
sudo apachectl restart
You are now ready to put files to ~/Sites/ folder and when you go to: http://localhost/ you will see those files appear, and if you add a .htaccess file, that is going to work.permalink
If you enjoyed the article, please share it
comments powered by Disqus
My name is Guillermo Garron. I am telecommunications engineer from Bolivia
I like technology a lot, and this site is mainly dedicated to that
Posts via email
If you use the letter icon above and subscribe to my tinyletter newsletter, you will get one to two emails, related to this site, or not. If what you want is to get the posts of this site via email, use the form below