Search code examples
htmlhref

Root file from server folder in html


How do I grab or href a file from root folder using this method:

../../../pages/development/topic/programing.php

I am having some problems using this method, trying to link from to domain folder(root folder), so used this method.

<a href="$_SERVER['SERVER_NAME'] ./pages/development/topic/programing.php" class="btn btn-xs btn-success">Read more</a>

But this doesn't work, so how do I link a file form root folder


Solution

  • You can directly specify the complete address in href of the destination as shown below.

    <a href="http://www.example.com/pages/development/topic/programing.php" class="btn btn-xs btn-success">Read more</a>
    

    or use this instead

    <a href='http://".$_SERVER['SERVER_NAME']."/pages/development/topic/programing.php' class="btn btn-xs btn-success">Read more</a>
    

    This will also work fine.