Welcome Guest, Not a member yet? Register   Sign In
Linking problem
#1

[eluser]Redwhirl[/eluser]
I'm starting and have a problem

From my main page I have put a link to a product page with <a href="product">Product</a> where product is a controller named product.php

When I click the link I get an error, but if I put <a href="index.php/product">Product</a> it works.

I haven't change anything in the default config, and the url helper is loaded

A little help would be useful

Thanks

Hubert
#2

[eluser]Narkboy[/eluser]
Can you post the actualy text of the link in your code please? Can't help without knowing what you're doing!

The two links you've posted:

http://product/

and

http://index.php/product

_might_ highlight the problem:

You must change the config.php file so that it reflects the correct domain you're using:
Code:
$config['base_url']    = "http://localhost/";
// Change to whatever your domain
Once you've done that, the index page needs to be correctly set:
Code:
$config['index_page'] = "index.php";
If you are using mod_rewrite, then set it to blank. If not leave it as index.php but your URLs will all need index.php before any controller / method calls:

Code:
// If you have:
$config['base_url']    = "http://localhost/";
$config['index_page'] = "index.php";

// Then:

http://localhost/                          // Link to home page
http://localhost/index.php/product/        // Link to the product page

Hope that helps?

/B
#3

[eluser]Redwhirl[/eluser]
Thank you Narkboy for your answer

I find the solution here : http://ellislab.com/forums/viewthread/66233/

my link must look like this : <a href="&lt;?php echo site_url('product'); ?&gt;">product</a>

Thanks again




Theme © iAndrew 2016 - Forum software by © MyBB