Forum Moderators: phranque

Message Too Old, No Replies

How to set up my local apache test server like my release server?

         

neurofuzzy

5:05 pm on Nov 24, 2011 (gmt 0)

10+ Year Member



I have an apache server set up on my development machine, but the directories are a bit different when compared to my release server. I'm a bit of a noob when it comes to web development so please bear with me.

On my website, whenever I access [mywebsite.com...] that brings me to ~/public_html/<file> on the server. However, on my local machine, ~/public_html/<file> when I'm logged in as "user" is accessed as [localhost...] What this means is that any time I try to use paths like "/img/home.png" that tries to bring up the file "localhost/img/home.png" instead of "localhost/~user/img/home.png". How can I set it up so that my /home/user/public_html directory is the default directory requested when I access localhost?

I know that I can have a variable, and so before every html link I can do something like:
<?php echo("<img src=\"".homevariable."/img/myimage.png\"></img>") ?>

but I really don't want to have to do that...

lucy24

6:45 am on Nov 27, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Better come back and explain exactly what kind of server you've got on your local machine. Is it a MAMP/WAMP type of thing? If so, there's a Preferences setting that lets you change your document root.