This guide will help you run WordPress(the blog app that runs this website) in your own personal Mac for testing purposes or for backing up your blog. On WordPress on Mac – Part 1: PHP & Mysql we covered installing PHP and MySQL. On part two we’ll cover setting up local sub-domains. What is a sub-domain and why do I need one? Sub-domains are websites with absolute URLs that are accessed via a prefix to the url i.e.the server mail.earthlink.net is a sub-domain of earthlink.net. Why do I want to do this locally? Because it will make it possible to mimic your website structure locally. In other words, it’s all about file paths. If you set it up your images and link will work, if not, you’ll have broken links and images.

Step 1: Setting up Apache
Apache comes as part of Mac OS X and it can be easily activated by the click of a button. However there are a few tweaks we need to do to Apache before we can use it for WordPress. To modify the Apache settings we need to edit some configuration files that are in some hidden folders. Now here a nerd will tell you to open the command line and edit the files in some DOS looking environment. But since we’re not nerds here, just cool geeks, we’ll use the free text editing application Text Wrangler which allows you to edit hidden text files and takes care of file permissions when saving.
Download Text Wrangler.

User Apache file
First we’ll edit your apache user file so that we can use ModRewrite in WordPress. ModRewrite is what translates search friendly URLS to the true url. From Text Wrangler, select “File > Open Hidden…” , make sure you enable “All Files” and navigate to the folder “etc/httpd/users/” then open the file of the current logged in user. In my case it’s “melvin.conf”.



Comment out these lines within the directory lines by adding the # symbol at the beginning of the lines:
#Options Indexes MultiViews
#AllowOverride None
Then Add the following lines
AllowOverride All
Options Indexes MultiViews ExecCGI FollowSymLinks Includes
Order allow,deny
Allow from all
Close the file.
Mod-Rewrite Log
Now we’ll specify where to log any errors for Mod Rewrite. From Text Wrangler, select “File > Open Hidden…” and navigate to “etc/httpd/httpd.conf”. Go to the end of the file and add the following code:


# begin custom edit
# mod_rewrite
RewriteLog /var/log/httpd/rewrite.log
RewriteLogLevel 9
#end custom edit
Keep the file open for the next step.
Local Sub-Domains
Next we’re going to set up a local sub-domain. This will allow our site URl to be “http://blog.localhost” instead of “http://localhost/~username/blog”. A local sub-domain will allows us to set up our local blog in the same way we would if we had it hosted at a public server. For example we use absolute URLs like ‘/images/header.jpg’ and that code will work on both local or public servers. It also makes for a very short and manageable URLs.
From Text Wrangler, add the following code after the Rewrite segment we just added but before the “#end custom edit” line.

# virtual hosts
NameVirtualHost 127.0.0.1# localhost
ServerName localhost
DocumentRoot /Users/melvin/Sites/
# wordpress.localhost
ServerName wordpress.localhost
DocumentRoot /Users/melvin/Sites/Projects/wordpress
# change the sub-domain name to your desired sub-domain name
# change to the name of your home folder
# change to the path of your project folder from the Sites folder
The first part will link “localhost” to your personal “SItes” folder. The second part is to specify the sub-domain. In this case I want the sub-domain “http://wordpress.localhost/” to test a custom version of wordpress, however you can rename this to whatever you want. Replace the path of DocumentRoot to the path to your site. In my case I put all my projects in a folder called Projects in the Sites folder in my home folder. For this example I am using the folder name wordpress but you can rename it according to your project name. Repeat this second block for each sub-domain needed.
Close the file.
Hosts File
Next we’ll add the sub-domains to the list of hosts. From Text Wrangler, select “File > Open Hidden…” and navigate to “etc/hosts”. Add the following line to the list. Make sure you specify the same sub-domain you did in the previews step:


127.0.0.1 wordpress.localhost
Restart the Apache Server
From the Finder select ‘Apple > System Preferences > Sharing > Services’ and Start ‘Personal Web Sharing’. Quit System Preferences.

Now point your browser to http://wordpress.localhost or whatever sub-domain name you chose.

If you don’t have anything in the folder you specified in the previews step you will get this 404 Not Found Error. This means it’s working. You can move any html files to that folder for testing. Or as we’ll do in the next Step of this tutorial, download WordPress and place the files on that folder.
Hello, I am Melvin Rivera; creator of
Follow me @


I had the same problem as Gavin and Lucio. like Eric I found editing the /Private/etc/apache2/httpd.conf file in the same way as described in the article does the trick.
Great Article Melvin. Super helpful
BLUE SKY OFFERS LOAN INVESTMENT (LOAN OFFER AT 3% INTEREST RATE)
We offer Loans to individuals, Firms and cooperate bodies at 3%
interest rate per annum, The Minimum amount you can borrow is
$2,000.00 US Dollars to Maximum of $10.Million.
Please, provide the following:
1. Name Of Applicant:…….
2. Age:………………….
3. Location:……………..
4. Amount Needed……..
5. Duration:……………..
6. Phone Number………….
7. Fax Number……………
Contact Email: blueskyoffers@live.com
Sincerely,
Mr.Eva Green,
Eva Green Loan Investment
+2347-0605-98450
after editing these files, web sharing will not activate. it tries for a long time but stays off.
hey,this is Laurence Thurman,just discovered your Post on google and i must say this blog is great.may I share some of the Post found in your website to my local people?i’m not sure and what you think?anyhow,Thank you!