• Hi guys,

    I use MAMP and WordPress quite a bit but I’m wondering how I would set up my config so I can use the root directory when referring to files. Im not sure if thats worded correctly but here’s an example. When using a live or dev server I do not have to add the full url when referring to files, rather I can simply refer to the wp-content directory (for example when referring to an image from the media library, “/wp-content/uploads/2013/03/img_homefinder.jpg” instead of having to refer to the full url “https://myprojectsdomain.com/wp-content/uploads/2013/03/img_homefinder.jpg”). Unfortunately this does not apply when running locally on MAMP as it turns up a missing image icon.

    Is there something that I can add to my config file or anywhere that will fix this so it adds the root directory and/or calls the correct image/file directory? Hope this makes sense, appreciate all and any help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter aronjeney

    (@aronjeney)

    Hmmm.. Did I not word that correctly? I would definitely appreciate any input on this matter. Let me know if this is confusing and I will try to re-word. Thanks in advance!

    Not too sure how you get that to work, anywhere, using a relative path. AFAIK, WP is absolute paths, unless using a plugin or the like.

    Also, what benefit are you looking for in doing it contrary to the WP default?

    If I understand correctly, it sounds like you’d like to use a relative path rather than an absolute path.

    You should be able to get this behavior by loading your MAMP WordPress site at
    https://localhost/
    rather than
    https://localhost/wp-project-directory/

    To make this change, go to MAMP > Preferences > Apache > Select…
    and choose the root directory of your WordPress site (i.e. where wp-activate.php and wp-blog-header.php are located).
    You will then need to Stop Servers and Start Servers to reload Apache with the updated settings.

    The disadvantage to this solution is you’ll only be able to work on one site at a time locally.

    Thread Starter aronjeney

    (@aronjeney)

    Thanks all. Sounds like relative/absolute paths has been an issue / desired feature for WP for a while now. I hope this changes in the future but I will be sticking to absolute paths for now. I appreciate your insight!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Setup root directory on MAMP’ is closed to new replies.