Relative paths


#1

Hi

I’ve just joined Dreamhost and I’m having a bit of difficulty getting set up. The website I’ve been building works ok in XAMPP, and now I’m trying to get it to function correctly on Dreamhost.

Sorry if this is going over old ground - I’ve looked through the forum and tried things out but haven’t got the solution! It seems what I’m doing should work.

I’ve presently got the site’s structure looking like this:

URL appears:
www.mydomain.com/index.php

Public files:
mydomain/public/index.php (etc)

Config etc:
mydomain/private/(non public files here)

There must be something wrong with how I’m pathing to the non-public files. I’m using the same relative paths to access the private folder, but they only work sometimes.

e.g. (from index.php)
require_once(’…/private/thisfileisfound.php’);

That works! However:

Will not work

That gives me a 404. I get a url that looks like this:

www.username/private/thisfileisnotfound.php

I’m confused - why does the relative path work for the require but not the href?

Many thanks :smiley:


#2

A href is a hyperlink and must reside inside the web-accessible part of a domain (ie. inside your mydomain.com directory).

An include just needs to be accessible on the filesystem - as it isn’t accessed directly by a web browser.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost