Learn how to a build a cloud-first strategyRegister Now


path problems php, trying to enable easier file management, paths are linking to new folder file is located in.

Posted on 2007-09-27
Medium Priority
Last Modified: 2013-12-13
I currently have most of my files located in my root folder of my website.  I want to breakdown the site for easier management and in doing so I am running into path issues.  For instance, if you look at the following link  http://www.milehighlistings.com/pricing/  all the links(navigation bar, sidebar etc.) are referring to the pricing folder.  How can I fix this without having to modify each link or add these files to my pricing folder.  
Question by:mnoel76
  • 3
  • 2
LVL 22

Accepted Solution

RedKelvin earned 800 total points
ID: 19976173
Hi mnoel76

The page you have given is located in the pricing folder.

All of your links have no path prefix, so they are all looking  in the current folder, which is "pricing"

If you want all of these files to look in another location, you have no choice but to code the new paths in.


Author Comment

ID: 19976633

If some of these files are located in my root folder and within those files there are links to other dynamically generated files in the root folder how do I code to handle this.  For instance, in the sidebar I have a php file called most_popular which links to a file in the root folder..http://www.milehighlistings.com/detail.php?id=12(dynamic) is there anyway I can code to handle queries from both the root folder and the pricing folder or do I need to copy the most_popular file to the pricing folder to handle this?  I hope I have explained this clearly for you.

LVL 22

Assisted Solution

RedKelvin earned 800 total points
ID: 19977688
Ok, i think I know what you are after, you are creating the paths from 2 different folders, however all of your paths are relative paths. ie. the files have no path in front of them, so they are looked for in the same folder as the parent.

One way around this is to specify the full path to the files in your links.

eg. instead of MyFile.htm use

Hope that helps
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 16

Assisted Solution

LeeKowalkowski earned 200 total points
ID: 19986373
You could put a BASE element in your HTML HEAD.  It's recommended to be before any stylesheet or script includes.

Personally, I would have had all my local links start with a slash (/) from the start.

LVL 22

Expert Comment

ID: 20027158
Hi there,
How are you going with your problem, any updates? Have any of the suggestions helped?


Author Comment

ID: 20140399
RedK thanks for checking in.  Just got back from Honeymoon.  I have decided to abandon breaking up the site into folders for the meantime.   Thanks everybody for your input!

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question