Debugging locally using Eclipse, MAMP, and virtual domains

When setting up debug configurations for Eclipse, I often have my files living in a subdirectory of my web server root. For example, at directory drydock/ I have a full replica of whatever live site I am working on.

On my hosting, I have the same directory structure and a subdomain set up so that drydock.crotown.com maps to the drydock subdirectory. Then the site drydock.crotown.com lets me put changes on the web for testing and approval, before the actual live site is touched.

On my local machine, until recently, my only domain was http://localhost:8888. So for debugging the page users/crotown, for example, I would have the "file" set to /drydock/index.php and the "URL" set to drydock/users/crotown. This worked fine if I was debugging the generation of that page, but any redirects would not work right since the base URL was http://localhost:8888 and NOT http://localhost:8888/drydock as it should have been. So the URL for redirects would be missing the "drydock/" part and cause a "Page not found" error. Also, paths to image files would be missing the "drydock/" part resulting in lots of missing images when the site was viewed.

The solution? I created a virtual domain called drydock.local so that the URL http://drydock.local:8888 will automatically map to the drydock/ directory and the URLs would not have to have have this part added to work correctly. To do this, I followed the instructions here and here on the MAMP Forum.

All I had to do was add the new virtual server to Eclipse at "Preferences-->PHP-->PHP Servers". Now when I visit "Run-->Debug Configurations..." I can select the new virtual domain in the "PHP Server" drop down menu. Then I can set the URL at the bottom of the Server pane, without the "drydock/" and everything, including all the redirects and images, works correctly in my debugging instance. Well, everything except whatever I'm debugging...

Drupal SEO