Does happen to all sites

  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

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.
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

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.
  • tastysite
  • Proficient
  • Proficient
  • User avatar
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

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
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

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.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

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).
  • Zwirko
  • Guru
  • Guru
  • User avatar
  • Posts: 1417
  • Loc: 55° N, 3° W

Post 3+ Months Ago

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
  • Posts: 349
  • Loc: Brighouse, West Yorkshire, England

Post 3+ Months Ago

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
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

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. :)
  • SpooF
  • ٩๏̯͡๏۶
  • Bronze Member
  • User avatar
  • Posts: 3422
  • Loc: Richland, WA

Post 3+ Months Ago

Try putting this in your source:

Code: [ Select ]
<base href="http://www.domain.com/">
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8415
  • Loc: USA

Post 3+ Months Ago

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.

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 51 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.