Anay Pareek Anay Pareek - 1 year ago 74
PHP Question

File don't get attached when I use absolute path in HTML CSS

I was using PHP

function to include the 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
file using
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 doesn't work.

The 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