Root folder issue in html when using the VPS URL given to me

Avatar
  • Answered
I am a new inMotion customer, and before I migrate my site to inMotion, I want to test it all out. So, they provided me with a URL to use for testing which is something like http://vps1xxx3.inmotionhosting.com/~talent55/

My problem is that in my CSS and HTML code, I use references that refer to the root directory (/) such as "/images/test.jpg". Notice it starts with a slash character.

If the site was live with my own company URL, then the root would point to the public_html folder, but since i am accessing my test version using the vps URL, the root is NOT pointing to the subfolder within the VPS but instead to the folder one level up, which I guess is technically the root the way the URL is structured.

So, as an example, instead of getting the following URL (http://vps1xxx3.inmotionhosting.com/~talent55/images/test.jpg) I am getting (http://vps1xxx3.inmotionhosting.com/images/test.jpg) which is not found as it is referring to the root directory at the VPS, not the subfolder that contains my site code and folders.

Is there a solution in htaccess that will allow me to have all site references point to where my site is so that I can use src and href references that begin with the "/" root designator?
Avatar
Scott
Hello Telentville, Thank you for your path reference issue. This is not truly an issue though it is seen when using the Temp URL and having path references that start with /. This is because the Temp URL has a root directory that is /home/username whereas the document root of the domain would be /home/username/public_html. The best solution to use avoids having to go through paths and remove the /. This solution is to use a hosts file mod. This can be enabled and disabled at will from your local machine (by commenting or removing the lines in the file) so that you can view the new site as it should be prior to switching the domain to our servers. Kindest Regards, Scott M