Chaitanya Chandurkar
Chaitanya Chandurkar

Reputation: 2187

CSS not loading after tampering URL

I'm running my test site on localhost.
when i load it with URL:
localhost/projects/forums/index.php

enter image description here

It looks like this (As Expected)
But when

i give URL:
localhost/project/forums/index.php/ ( / after index.php)

Css don't load.

enter image description here

looks like this.

Can anybody tell me how to tackle this?
i have seen the same issue on many websites.

Upvotes: 0

Views: 85

Answers (1)

Quentin
Quentin

Reputation: 943936

Either:

  • Don't stick / on the end of the URL of the page
  • Test the URL in your script and 301 redirect if it isn't the canonical URL you want to use
  • For your links (including <link>s), use root relative URLs instead of current document relative URLs (i.e. start the URLs with a /)

I'd use all three myself.

Upvotes: 2

Related Questions