farmer
February 10, 2011, 4:24am
1
There is an example web site named mysite under the local host on my computer, and an images sub directory and fr sub directory under mysite. On web host server, the fr will be a subdomain, it is http://fr.mysite.com . On the test computer, the fr is only a sub directory.
In the fr directory, there is a web page named show_image.htm, it will show an image which locates in images directory. here is the html code:
<img border=“0” src=“…/images/screenshot.png” width=“900” height=“700”>
When I test the html web page on my computer using http://localhost/mysite/fr/show_image.htm , the image will appear on the web page. However, after I uploaded the file to the web host server, and tried to access the web page at http://fr.mysite.com/show_image.htm , the image file didn’t appear.
Who can tell me why the relative path doesn’t work after the file uploaded? How to resolve the problem? Thank you!
…/ does not take you from fr.mysite.com to mysite.com . It never has, it never will. That’s not what it has ever been used for.
You could instead use mysite.com/images/screenshot.jpg and have your local test machine set up to redirect mysite.com to the appropriate local location
farmer
February 10, 2011, 9:18am
3
<img border=“0” src=“…/images/screenshot.png”
On local host: the URL works: http://localhost/mysite/fr/show_image.htm , the “…/” will refer to parent directory.
On web host server, the URL doesn’t work: http://fr.mysite.com/show_image.htm
I prefer to use relative path, are there any configuration needed for the web host server?
If relative path can’t work in subdomain, I will switch to use absolute path, for example:
<img border=“0” src=“http://www.mysite.com/images/screenshot.png ”
farmer:
I prefer to use relative path, are there any configuration needed for the web host server?
If relative path can’t work in subdomain, I will switch to use absolute path, for example:
<img border=“0” src=“http://www.mysite.com/images/screenshot.png ”
You can use the Rewrite rule in .htaccess to rewrite any URL of the form fr.mysite.com/*.png to www.mysite.com/*.png .