Welcome Guest, Not a member yet? Register   Sign In
can't open links!
#1

[eluser]pck76[/eluser]
Hi I'm a newbie and experimenting with codeigniter.

My index method creates a simple link ("welcome/test/3). So I would expect that method "test" of controller welcome would be called when clicking on the link.

Code:
function test()
{
   echo "this is just a test";
}

Instead of this simple string, I see a 404 error.

I don't understand what I'm doing wrong - can you please help me?

thanks,
P.
#2

[eluser]2think[/eluser]
I'm guessing you may have figured this out by now but if not, read here on URI segments:
http://ellislab.com/codeigniter/user-gui.../urls.html

Read up on it, the entire page so you get a firm grasp of the concept. Which it seems you know but just in case.

Anyway, remove the 3 and it should be fine ('welcome/test')
#3

[eluser]pck76[/eluser]
actually it didn't work even removing the "3" at the end.

I thought it could be because of the htaccess mod rewrite rule, although I'm copying it from the book I'm using to learn codeigniter, so I'm not entirely clear what it does.

Here it is:

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

does this make more sense to you?

thanks,
P.
#4

[eluser]2think[/eluser]
Hi pck76,

I'm definitely not any expert on mod_rewrite but I'll try to help.

I know I have followed this page in the wiki and the linked info on the htaccess with success, maybe it will help you some.

http://codeigniter.com/wiki/Better_Server_Setup_for_CI/
#5

[eluser]tomcode[/eluser]
Does Your link work without rewriting ?

Are You using a relative URL in Your link, this might cause problem, depending on which page You are.




Theme © iAndrew 2016 - Forum software by © MyBB