Does happen to all sites

  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Joined: Apr 09, 2008
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England
  • Status: Offline

Post May 11th, 2009, 9:50 am

I have just noticed that on my site if you add a / in to my URL after the index.php it changes the path and so images and the external stylesheet is lost. EG

My URL for my site is
mysite.com/index.php
but if it becomes mysite.com/index.php/ it breaks the path as you would exepet

I've tried to get other sites to do this but none will so what are people doing to stop it happening? :) I know its miner but its bugging my now I know about it.
^__^
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 11th, 2009, 9:50 am

  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Joined: Jul 25, 2005
  • Posts: 2735
  • Loc: Nashville, TN
  • Status: Offline

Post May 11th, 2009, 9:53 am

Looks like you're not alone - I just google'd index.php and came up with this site, http://www.freerice.com/index.php which breaks when you add the trailing slash.
I'd love to change the world, but they won't give me the source code.
  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Joined: Apr 09, 2008
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England
  • Status: Offline

Post May 11th, 2009, 10:02 am

o good so its not me my worry is that if my site is linked by people they do tend to type the URL like mysite.com/index.php/ (i know ive seen it and I do) Im confused why it happens I would of thought that if nothing is after the / then the fact it is there would not direct it up one level in the directory
^__^
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Joined: Jul 25, 2005
  • Posts: 2735
  • Loc: Nashville, TN
  • Status: Offline

Post May 11th, 2009, 10:54 am

Not entirely sure why that processes somewhat correctly, but it does. Regardless, if you're using relative paths for your images, then I can understand why it would mess them up (given that it's rendering the page at all).

However, this is the first I've seen someone mention it. I can't imagine that it's too large of a problem to worry with. If it really bothers you, I suppose you could chdir back where you intended to be? don't know, I wouldn't worry much on it.
I'd love to change the world, but they won't give me the source code.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 23403
  • Loc: Woodbridge VA
  • Status: Offline

Post May 11th, 2009, 11:14 am

What's interesting is
http://www.boastingrights.com/index.php/
breaks my phpbb board as described, but

index.php/
doesn't break OZZU


???
Not that I can understand why anyone would put a trailing slash to begin with. In essence that would make index.php a directory, vs. a file and it would then be looking for a default index.php file in the index.php directory (in theory anyway).
"There's no place like 127.0.0.1 except for ::1."
Alexandria Networks. Leader in IT consulting for associations/non-profits, and small to medium sized businesses around the northern Virginia and Washington D.C. metro area.
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Joined: May 29, 2005
  • Posts: 1417
  • Loc: 55° N, 3° W
  • Status: Offline

Post May 12th, 2009, 2:17 am

It happens to my site too; don't know the hows and whys however.

I doubt it is a common problem though. If you'd like to reduce the incidence of it even further then you could consider making links on your own site point to the home directory rather than the index file within that directory. That way, nobody will ever see "index.php" up in the address bar and can't copy and paste it anywhere with a rogue slash at the end.
  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Joined: Apr 09, 2008
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England
  • Status: Offline

Post May 12th, 2009, 9:44 am

your right really its just a small thing
It was just an interesting problem, actley I think it may have something to do with the host because im hosting my site on my own server at the moment so that my have something to do with it.

Anyway its one of the kind of problems you can spend hours trying to fix even though it don't matter!
^__^
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post May 12th, 2009, 10:49 am

I've got this in the htaccess of a directory named "/rewrite/", which gives me a path of http://domain.com/rewrite/

Code: [ Select ]
RewriteEngine on
RewriteBase /rewrite/
 
RewriteRule ([^/]+)\.(php|html)/$ $1.$2 [R=301]
  1. RewriteEngine on
  2. RewriteBase /rewrite/
  3.  
  4. RewriteRule ([^/]+)\.(php|html)/$ $1.$2 [R=301]


It should redirect any HTML or PHP file with a directory separator on the end to the page without the separator. It does for me.

If you don't have URLs like these floating around already that you want to fix though, it's probably better not to give the server this extra work for every page request. :)
Strong with this one, the sudo is.
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Joined: May 22, 2004
  • Posts: 3415
  • Loc: Richland, WA
  • Status: Offline

Post May 12th, 2009, 11:21 am

Try putting this in your source:

Code: [ Select ]
<base href="http://www.domain.com/">
#define NULL (::rand() % 2)
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post May 12th, 2009, 4:02 pm

SpooF wrote:
Try putting this in your source:

Code: [ Select ]
<base href="http://www.domain.com/">

That doesn't fix that for me... although that was a good idea.
"Bring forth therefore fruits meet for repentance:" Matthew 3:8

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 101 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.