Issue with URL's

Hello all, new user of CI, but long time PHP programmer and web developer.

I'll jump right into it. I seem to be having some issues with links. The default action is index, however if the URL isn't set to <controller>/index URL's become messed up and I'm not really sure why (they point to the default route).

So, <controller>/ and <controller>/index are not acting the same way, and I think they should be.

I know I can avoid the problem by using the anchor helper, however I'm converting a pre-existing script with a lot of links and would rather not change them all within the view.

Hope I am explaining this correctly.

Let me try to explain this a little clearer.

Say I have a URL

Everything works fine with links like:
<a href="./components/view/&lt;?=$row->id?&gt;">view</a>

However say I have the URL:

Then the links which worked fine before point to something similar to...

Which is correct technically, but I need a way to prevent or stop this, I'm hoping its simply a configuration option somewhere.

Thanks in advance.

[eluser]Rick Jolly[/eluser]
Three options:
// 1. using the "base" tag in the "head" you can use relative urls:
&lt;base href="&lt;?=base_url();?&gt;"&gt;&lt;/base&gt;
<a href="components/view/&lt;?=$row->id?&gt;">view</a>

// 2. absolute
<a href="&lt;?=base_url();?&gt;components/view/&lt;?=$row->id?&gt;">view</a>

// 3. relative to webroot
<a href="/components/view/&lt;?=$row->id?&gt;">view</a>

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.