0

I have written my own blog let’s say at example.com. I’ m trying to use footnotes for my posts. So I have a post at the address:

http://www.example.com/blog/2012/04/post-slug

I use this code for the footnotes (produced by markdown-extra):

<p>That's some text with a footnote.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup></p>

<div class="footnotes">
<hr />
<ol>
<li id="fn:1">
<p>And that's the footnote.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>
</ol>
</div>

This code is saved in the database as the post’s body.

The problem is that when I point to the browser to the post and click the links they point to the home page of my site like this:

http://www.example.com/#fnref:1 

and

http://www.example.com/#fn:1 

Instead of the correct:

http://www.example.com/blog/2012/04/post-slug#fnref:1

And

http://www.example.com/blog/2012/04/post-slug#fn:1

respectively.

That is they don’t take in mind the part of the URL

/blog/2012/04/post-slug

They "think" they are in the home page for some reason. In Codeigniter I have chosen not to include index.php in the URL. And of course I have some routing definition in the routes.php file. I cant’ figure out why this problem occurs. Maybe it has to do with routing. I have tried all the available options in the config.php file:

$config['uri_protocol'] =  'AUTO';  

(PATH_INFO etc) but didn’t help.

Can anyone help? Thanks in advance.

Kostas
  • 97
  • 1
  • 4
  • 14

1 Answers1

0

CI always behaves as it's in the root this because that's where its index.php file is located and all the controllers/methods are called from there. To solve your case, I'd suggest you add a path to your href attribute, or use base, like Zenbait said.

Shomz
  • 37,421
  • 4
  • 57
  • 85
  • I guess that if I continue using 'base href' I must add the correct path to my anchors manually or alter the markdown library to add the path to the anchor. – Kostas May 02 '12 at 22:19
  • Yeah, avoiding `base` is a better idea. – Shomz May 02 '12 at 22:22