Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6755861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:27:11+00:00 2026-05-26T13:27:11+00:00

From my previous experience, I’ve almost always had problems with linking files with my

  • 0

From my previous experience, I’ve almost always had problems with linking files with my website projects.

For example, linking CSS styles, Javascript files and including files in PHP. The problem is, that on my PC, the directory of my project was /www/project-name/ and when I put the project on a server, the directory would be just /www/. When I uploaded the project to a server, images wouldn’t show, styles wouldn’t work, database connections wasn’t set, functions were not defined etc…

So my question is: What is the best and most efficient way to link/include files?

Something that will work no matter what the directory of the project is, and possibly, if I include project/includes/mysql.class.php in file1.php, and I move that file to a different directory, it would still properly include project/includes/mysql.class.php

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:27:12+00:00Added an answer on May 26, 2026 at 1:27 pm

    You should use relative paths.

    Instead of specifying the full path (‘/www/project-name/includes/whatever.php’), use a path relative to the current location:

    './includes/whatever.php'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From previous experience I had been under the impression that it's perfectly legal (though
Migrating from PHP to EJB , I have previous experience of PHP , C++
I am a Haskell newbie, though had a previous Lisp/Scheme experience. Right now I
In my previous Grails project(high transaction volume), I had horrifying experience with Stale Object
From previous post, I learnt that for there are two ways, at least, to
Note: This question has broadened in scope from previous revisions. I have tried to
Given <field name=frame.time_delta_displayed showname=Time delta from previous displayed frame: 0.000008000 seconds size=0 pos=0 show=0.000008000/>
From a previous question I have seen that the CLR has workstation and server
From a previous question , I learn that Linq to SQL is not able
From my previous questions about gettext, one of the biggest benefits of using PHP's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.