Issue
I'm trying to open a PHP project using netbeans, this project was not created by me, so I move it into htdocs folder, but localhost does not recognize it and this error showed up: (localhost worked properly when I create project myself)
The location of the project is : D:\xampp\htdocs\S21\project21
so I tried this url: http://localhost/s21/project21/index.php
and it did open, however without styles. It didn't load stylesheet files.
I even edited any location inside the PHP files to the new URL but it's still not working.
any idea about why this happened? And how to fix?
Solution
Your location is : D:\xampp\htdocs\S21\project21
, so the correct URL is http://localhost/s21/project21/index.php
.
so I tryied this url: http://localhost/s21/project21/index.php and it did open but without style.it didnt load stylesheet files.
You need to change your asset URL :
<link rel="stylesheet" href="http://localhost/s21/project21/your-style.css">
<script src="http://localhost/s21/project21/your-script.js"></script>
You can still use :
<link rel="stylesheet" href="your-style.css">
<script src="your-script.js></script>
But, if you use mod_rewrite
eg : you access to http://localhost/s21/project21/another/endpoint
, your assets will be not found.
If you use /style.css
, it will access to http://localhost/style.css
.
Answered By - Wahyu Kristianto
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.