help getting website root directory
I am developing a new site that right now is at http://188.8.131.52/~zluthorg/. When I'm creating links to images/other pages, I can't just use "/" as the website root directory because that goes to http://184.108.40.206, instead of http://220.127.116.11/~zluthorg/. Is there a way to get http://18.104.22.168/~zluthorg/ from a php $_SERVER variable or some other means, so that when the site goes live, I don't have to replace a ton of /~zluthorg/ with just /?
I hope you can understand what I'm trying to do.
Last edited by jrthor2; 02-03-2008 at 12:58 PM.
you could use ./ instead to reference the current dir, that way you don't have to keep adding the path name, but then you run into problems with sub directories...
should return the path to the current file(eg: /~zluthorg or whatever). but then that doesn't solve your problem completely, since sub dir's will still cause a problem.
my solution has always been to run a single include in all files carrying several usefull peices of info:
then just use it like so:
<img src='<?=im_path;?>my_image.png' />
so then when the site goes live, the address will be www.zluthorg.com, I just need to change those values to "/" so they point to the web root?
well, includes path is what I use for my includes, and tend to point away from accessible files.
But yeah, you point im_path to '/' when you get your own domain/subdomain.
yeah, include files I'm good with, it's just links/images that I don't want to have to change all over my site.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)