I have a website and am using Bootstrap but for some reason when I go to index.php everything works as it should, but if it is to index.php / (with the end bar) the HTML code loads more the rest, not css or js or anything.
I have a website and am using Bootstrap but for some reason when I go to index.php everything works as it should, but if it is to index.php / (with the end bar) the HTML code loads more the rest, not css or js or anything.
You should be using a relative address for your CSS file:
<link rel="stylesheet" type="text/css" href="arquivo.css">
When you do this, the browser will look for the file in different addresses, depending on the presence of the bar or not:
If the address bar contains http://192.168.2.106/PAP/index.php
, the searched file will be http://192.168.2.106/PAP/arquivo.css
If the address bar contains http://192.168.2.106/PAP/index.php/
, the searched file will be http://192.168.2.106/PAP/index.php/arquivo.css
To avoid this problem, you should use non-relative addresses:
Placing a slash at the beginning of the path to CSS , you can indicate that it is relative to the root:
<link rel="stylesheet" type="text/css" href="/PAP/arquivo.css">
In this way, the searched address will always be http://192.168.2.106/PAP/arquivo.css
, noting the host used in the address bar.
Another solution would be to put the full CSS address . It is a good option in case the CSS is on an external server ... otherwise you will have difficulty during the development of the program.
If you do this, consider placing the address without specifying the protocol, so as to use the same protocol that is written in the address bar.
<link rel="stylesheet" type="text/css" href="//meuservidor.com/PAP/arquivo.css">
I had the same problem creating SEF URLs and it was resolved by putting the server address on all requests from css and js, as Leonardo said in his comment. try using:
<link href="http://<?php echo $_SERVER['SERVER_NAME'];?>/PAP/css/estilo.css" ... />
So you will not have problems with the code when you go up to production.
I hope I have helped