Index syndication
comment syndication

Archive for databases

MAMP vhost and WordPress

I’ve setup MAMP to do some local web development on my MacBookPro, and the XDebug plugin is awesome for stepping through PHP code.

However, I had a problem with MAMP and a vhost I setup for local development. The wordpress front page and /wp-admin/ worked but any sub pages, etc. failed to load. When trying to access a WordPress page at url http://site.local/music/ The error in the apache logs was:

[error] [client] File does not exist: /Users/lantrix/devel_projects/vhosts/site.local/music

I had made sure that mod_rewrite was enabled as mentioned by Samuel B over at the WordPress support forums. I had also ensured I had updated the permalinks in the local WordPress install, thus writing out a .htaccess for the rewrites. Still no luck.

Then I remembered, one needs to tell Apache that a directory outside the webserver root /Applications/MAMP/htdocs, in this case my vhost path of /Users/lantrix/devel_projects/vhosts/site.local, needs to have an AllowOverride so the .htaccess WordPress has placed can be used. This in combination with the apache Options directive to FollowSynLinks as mentioned by Mark at the support forums worked for me. No more 404 errors!

Below is my working vhost configuration at the bottom of my MAMP apache config file /Applications/MAMP/conf/apache/httpd.conf. It works for me, but YMMV: