Forum Moderators: phranque

Message Too Old, No Replies

server relative links, web site testing

         

Angua

12:17 am on Jul 13, 2008 (gmt 0)

10+ Year Member



I'm trying to test site pages with a new web host provider before pointing the DNS to the new host.

My new host provider provides a temporary location:
[server.hostprovider.com...]

I'm using "server relative" links (see JPMorgan NOTES below):
<href="/about/">about</a>

Since the temporary hosting space is one directory down and the web site uses relative links with the leading slash pointing to root, all the text and image links break. The host provider says this is only temporary until the DNS is updated and the site becomes www.mysite.com. Is there a simple .htaccess or httpd.conf rule that would allow the site to work using "server relative" links?

Thank you.

NOTES (JPMorgan on relative vs. absolute links):
Source: [webmasterworld.com...]

Page-relative: <img src="image.gif"> or <img src="../image.gif"> or <img src="images/image.gif"> or <img src="../images/image.gif>"
Server-relative: <img src="/image.gif"> or <img src="/images/image.gif>"
Absolute or canonical: <img src="http://www.example.com/image.gif"> or <img src="http://www.example.com/images/image.gif">

jdMorgan

12:26 am on Jul 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is that any such code would have to be installed in hostprovider.com/.htaccess or in the httpd.conf file for the hosting provider. You could ask, but I doubt they'd be willing to do that.

Another thing to consider, to prevent this problem, is to get (pay for) a unique IP address for your new host. With a unique IP address, you can test your new site/host using that new IP address, and the whole problem is avoided.

Jim

[edited by: jdMorgan at 12:27 am (utc) on July 13, 2008]