Welcome Guest, Not a member yet? Register   Sign In
500 Internal server error when clicking links
#1

[eluser]keld[/eluser]
Hi all,
I have this weird issue where the server returns a 500 internal server error when clicking a link to another page from my home page. When I load my site, the homepage shows up fine but none of the links are working but it works when the site is on localhost on my machine.
Any idea why?

Thank you.
#2

[eluser]InsiteFX[/eluser]
Show the code for your links!

InsiteFX
#3

[eluser]keld[/eluser]
I'm using the anchor tag:
Code:
<?= anchor('recipes/recipe/'.$featured['nameuri'], $featured['name'], 'title="'.$featured["name"].'"') ?>

The urls all look good like the way they should be.

Some of my urls are html <a> tags but the same happens.
#4

[eluser]d1a8lo24[/eluser]
Not sure but if you're using an .htaccess file you should start there, most 500 errors are server configurations related where an apache configuration is not available for you. After that check your PHP.ini if your application is using any .ini configurations.
#5

[eluser]InsiteFX[/eluser]
Also short open tags could be turned off!

Or if your passing the $data to the view and trying to use it in your anchor tags you are calling it wrong!

Show your controller code!

InsiteFX
#6

[eluser]keld[/eluser]
Yes I checked my htaccess I used to have a 500 error when I uploaded my site the first time because the htaccess wasn't transferred using the ASCII mode but Binary mode from Filezilla and it didn't like it. After re uploading it, it worked perfectly, at least for the homepage.
There's another htaccess in thje "appllication" directory but eit is there to protect direct access to the source files, but even if I remove it, I still have the issue.
(Again, this issue only happens when the site is online, locally, everything works fine).

I really don't think it's coming from the links because even if I paste the url of another page than the home page it returns error 500.
Anyway here's the controller for the homepage
Code:
function index()
    {
        $data['total']=$this->Mc_home->getTotal();
        $data['featured']=$this->Mc_home->getFeatured();
        $data['recent']=$this->Mc_home->getRecent();
        $data['main']='home';
        $this->load->vars($data);
        $this->load->view('template');
    }
Here is a piece of code from the controller of one of the page I'm trying to access
Code:
$get_uri=$this->uri->segment(3);
$data['recipe']=$this->Mc_home->getRecipe($get_uri);
$data['main']='recipe';
$this->load->vars($data);
$this->load->view('template');

The url of this page looks something like :
http://www.mysite.com/recipes/recipe/recipe-name

But even opening a simple flat html page like terms and conditions doesn't work.
#7

[eluser]cahva[/eluser]
Just check the apache(or whatever webserver you're using) error log. The error is described there in detail. That should be the FIRST thing to do, not debug code when you dont know why the error is happening in the first place.
#8

[eluser]keld[/eluser]
thanks cahva, that's what I tried to this morning but on godaddy following their instructions to find the logs using their cr*ppy interface, well it's not where they say it is so I'm waiting for a response from them.
#9

[eluser]InsiteFX[/eluser]
Your anchor tags should be like this!
Code:
&lt;?= anchor('recipes/recipe/'.$nameuri, $name, 'title="'.$name.'"') ?&gt;

// Not like this!
&lt;?= anchor('recipes/recipe/'.$featured['nameuri'], $featured['name'], 'title="'.$featured["name"].'"') ?&gt;

InsiteFX
#10

[eluser]keld[/eluser]
@InsiteFX: oh really I didn't know, what's the difference ? is my method bad? I learn CI using the CI 1.7 book. Your method is prettier Smile I'll update those links.
Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB