Forum Moderators: open

Message Too Old, No Replies

URL question

         

jessejump

5:38 pm on Nov 27, 2007 (gmt 0)

10+ Year Member



Hi:
My company uses a fairly well known web managemet system for our site.
Some of the paths to images they produce are:

http://www.example.com//images.image.jpg
The 2 // - is this valid - it does work - also, one slash goes to the same place
Thanks

[edited by: encyclo at 5:48 pm (utc) on Nov. 27, 2007]
[edit reason] switched to example.com [/edit]

mhanif

7:25 pm on Nov 28, 2007 (gmt 0)

10+ Year Member



Well, to me its new. First time i saw something like this. But if it works, it should be valid :)

May be there is some kind of trick used. Can you tell us the exact name of the image file?

Muhammad Hanif

[edited by: tedster at 7:29 pm (utc) on Nov. 28, 2007]
[edit reason] no personal urls please [/edit]

tedster

7:30 pm on Nov 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're on an Apache server, the double slash will be resolved by default. Still, it's not a good practice to have two different urls resolve to the same file.

rocknbil

9:07 pm on Nov 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'll add, from a programmer's viewpoint - this usually means there is either a missing variable somewhere OR - more likely - you have incorrectly configured your variables for the program. Example:

If I have a configuration for "home page" it is good programming practice to have a comment somewhere indicating NOT to use a trailing slash:

# Full URL to your site - do not add a trailing slash
$home= 'http://www.example.com';

# Name of your image directory - do not include slashes
$images = 'images';

The programming "builds" the paths from these values.
$thisimg = $home . '/' . $images . ' /' . $currentImage;

So if you enter this for $home

$home= 'http://www.example.com/';

what you get is

src="http://www.example.com//images/yourimage.jpg"

Now, a comprehensive program will fix this on the fly - but also from a programmer view, it's almost impossible to predict every possible mistake a user may make. :-)