Jump to content

File directory navigation php include


rorybing

Recommended Posts

Hi,

 

I have a file structure for all my files on my website that works fine for the most part. The basic layout would be something similar to the following.

 

- root folder

    - sub_folder1

        - folder1

        - folder2

    -sub_folder2

        - folder1

        - folder2

Each of the folders would contain relative .php files carrying out specific functions etc. The issue I am having is as follows. If I am on a webpage that is located in either of the folder1/folder2 folders, and I need to redirect somebody to a file located in the root folder, I am not able to do this without the page not being displayed correctly.

 

On the file located in the folder1 folder, I have a <? php include("page1.php");?> which works fine. Trying to access a file to redirect to from this folder, I have tried,

<? php include("../page1.php");?>, but this only bring me up one level,  <? php include("../../page1.php");?> which I think is wrong anyway, and doesn't work, and also  <? php include("./page1.php");?>, again does not work.

 

Does anyone know if it is possible to get the file from the subfolders to access a file located directly in the root?

 

Sorry if I'm not being clear explaining the layout etc.

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.