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 9168605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:39:52+00:00 2026-06-17T15:39:52+00:00

Im trying to create my own MVC. My folder structure is following: localhost (root,

  • 0

Im trying to create my own MVC. My folder structure is following:

 localhost (root, htdocs)
   - Project_1
     - images
       - test.jpg
     - App
       - Controllers
       - Models
       - Views
     - Classes

Now if i create an index file under views folder and add this:

    <img src="/images/test.jpg" />

this does not load test.jpg because / points to localhost (root/htdocs) folder and does not point to Project_1

My question is what do i need to do to make / point to Project_1 directory instead of root, i know it has to do something with VHosts but unfortunately i do not know any tutorial that would explain the problem.

Any ideas/suggestions or links to tutorials will be appreciated. Thank you

NOTE:
I do not want to do the following:

  define('ROOT', '/localhost/Project_1/');

and then use it like

  <img src="<?=ROOT?>images/test.jpg" />

this is what im trying to avoid

  • 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-06-17T15:39:54+00:00Added an answer on June 17, 2026 at 3:39 pm

    If all you are looking to do is change the base path of images then you might be able to get away with using the <base> HTML element.

    Taken from MDN –
    The HTML element specifies the base URL to use for all relative URLs contained within a document.

    As for the PHP side of things, the option you categorically dismissed would probably be the best way – defining a constant pointing to the correct path –

    define('ROOT', '/localhost/Project_1/');
    

    If you want to get into the settings of your virtual host, then you’ll be able to set your document root directly from the virtual host’s definition. Here is a simple example –

    <VirtualHost *:80>
        DocumentRoot /var/www/localhost/Project_1/
        ServerName Project_1.com
    </VirtualHost>
    

    Within this virtual host, your $_SERVER['DOCUMENT_ROOT'] will now be /var/www/localhost/Project_1/.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create my own little MVC system, its working very well,
Right now I'm trying to create my own tiny MVC (just for practice and
I am trying to create my own lightbox for images on my website. Yes,
I am trying to create my own helper function in ASP.NET MVC 3. Not
I am new to MVC and I am trying to create my own extension
i'm beginner to MVC framework. I'm trying to create one my own based on
I am trying to create my own Native win32 C++ Checkbox that can have
I'm trying to create my own Magento shipping module in Magento 1.6. Since I
I am trying to create my own torrent tracker but dont know how to
I'm trying to create my own plugin. But I'm having trouble getting things right.

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.