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

  • SEARCH
  • Home
  • 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 853083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:42:06+00:00 2026-05-15T07:42:06+00:00

I need 2 different paths, one for includes and one for js/css etc. I’m

  • 0

I need 2 different paths, one for includes and one for js/css etc. I’m using mod_rewrite. The below works fine….

Currently all my files contain this at the top

define('SERVER_ROOT',   'C:/wamp/www/site_folder/');
define('SITE_ROOT',     'http://localhost/site_folder/');

and then files are called like so:

require_once SERVER_ROOT . 'st_wd_assets/inc/func_st_wd.php';    

<link rel="stylesheet" type="text/css" href="<?php echo SITE_ROOT;?>st_pages/user_area/css/user_area.css" media="screen"/>

as you can probably see, it’s going to be a massive chore to update the top of every file everytime i move versions between the localhost and my live server.

What’s the best/standard way of defining these ROOT values?

I can’t see a solution in the $_SERVER super global? Do people normally just use VirtualHosts? But then wouldn’t it still be necessary to define ROOT constants?

  • 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-15T07:42:07+00:00Added an answer on May 15, 2026 at 7:42 am

    Yes.
    People normally just use VirtualHosts.

    There are several ways.

    • You can use a relative path to include a config file.
    • You can use a DOCUMENT_ROOT from the $_SERVER superglobal to place a config file there.
    • You can use web-server config if possible. like php_value auto_prepend_file in .htaccess
    • And at least you can detect your environment and choose between two roots, both written in conditions at the top.
    • And yes, if you’re using mod_rewrite – make a front controller which will include all the other files, so – the only one file to place these settings.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to read different values stored in a file one by one. So
I'm on a different path on the same site, and I need to allow
I'm coding an android app for parsing sms messages. I need different rules for
So long story short, i have some forms (2) of them that, need different
I need a different random number for each row in my table. The following
I have three different development machines. Do I need three different iPhone Developer Program
I have a Maven multi-module project and I need two different parent POMs in
I am doing a project in cakephp. Here I need a different layout. Please
I need to store different table markup code in a php array, as a
I need to concatenate different lines in a string. To do so, I need

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.