0

Im trying to put a link to local html file called Rules.html, but for some reason I cannot make it work.

Html file is in the same folder as my php file.

Note that Im running my forum on localhost:1337, Should that be somewhere in that line too? Here is my piece of code:

   <li class="copyright">
    <a class="rules" href="file:///C:/xampp/htdocs/SMF/smf_2-0-6_install/Themes   
    /Fresh_v2_RC5/Rules.html">Rules</a>
   </li>
Alireza Fallah
  • 4,609
  • 3
  • 31
  • 57
user2815059
  • 329
  • 2
  • 6
  • 12

4 Answers4

0

If it is in the same folder as the file you are calling it from, you can just call it by name, instead of it's complete path.

<li class="copyright">
    <a class="rules" href="Rules.html">Rules</a></li>

Also, if you are calling it by it's full path name, you do not want to use file: to open a linked html document. You would call:

edit: (added // in front of localhost.)

<li class="copyright">
    <a class="rules" href="//localhost/../Rules.html">Rules</a></li>

And pull it up in your apache server. Using file is like opening the file in your file system, but to view html, use your web server.

WreithKassan
  • 205
  • 1
  • 7
0

I would suggest using relative links. So the link would be

href="theFile.html"

if it's in the same folder as the file you are trying to write the link in.

dansv130
  • 317
  • 1
  • 3
  • 12
0

Use relative path from your root dir. Root dir is a dir where located your html file within this code. For example, if you put this code in html file, located in htdocs dir, so the relative link is:

<li class="copyright">
    <a class="rules" href="SMF/smf_2-0-6_install/Themes/Fresh_v2_RC5/Rules.html">Rules</a>
</li>
Victor Bocharsky
  • 11,930
  • 13
  • 58
  • 91
0

As others have said, it's easiest in this case to simply use relative urls.

The way to do this with the code you've provided:

<li class="copyright">
    <a class="rules" href="Rules.html">Rules</a>
</li>

Make sure that this Rules.html file is in the same directory (dir) as the file from which you're calling it. If not, you'll need to do some directory traversing to get to it.

Here's a question with some helpful examples.

Community
  • 1
  • 1
Isaac Gregson
  • 1,999
  • 1
  • 21
  • 31