Anay Pareek Anay Pareek - 1 year ago 82
CSS Question

file dont get attached when i use absolute path in html css

i was using php include function to include header and footer but now i want to change location of my files so i created a folder named admin panel and created a php file in it. Now i want to connect my header.php file using include but all the path in header file are give in reference so i want to change it to absolute path but when i change it then it dont work example

reference file path is given like this-

<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all">

Now when i change it to absolute then it dont work

<link href="/home/username/public_html/css/bootstrap.css" rel="stylesheet" type="text/css" media="all">

i am having godaddy hosting so this is the way to add absolute path in godaddy they say.
this is godaddy's answer link-

If i am doing something wrong then please tell me thanks in advance.

Answer Source

If you use a forward slash at the beginning of your path, the path will start in your root folder.

Like this:

<link href="/css/bootstrap.css" rel="stylesheet" type="text/css" media="all">

This path should work in any file in any directory.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download