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

[eluser]Lockzi[/eluser]
Hello,

I have the wierdest problem with mod_rewrite ever! I run the latest version of WAMP, I've been developing on this install for about a month, no problem at all. Now I started a new project it all seemed fine.

The index page works fine, but as soon as I link to a different function in the same controller, I get this error message (I'm autoloading the database library, by the way):

Code:
Fatal Error: Connection to database failed.

Even though I have

Code:
function viewforum()
    {
        die(var_dump("test"));
        ...
    }

It all works fine if I have

Code:
$config['index_page'] = "index.php";
in the config.php file.

Here's my .htaccess file as well

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>
#2

[eluser]leonglass[/eluser]
Not sure if this is your cause or not but you do not need the RewriteBase / line. All rules in a per directory scope <directory > or .htaccess are parsed according to the directory they are in. The rewrite rule is a bit dangerous also as you could easily end up looping. As I said not sure if that has anything to do with your database connection or not.
#3

[eluser]smith[/eluser]
If yoyr mod_rewrite is wrong all you can endup with is "page does not exist". mysql connection is used at the server side and it has nothing to do with mod_rewrite, as far as i know...
#4

[eluser]Lockzi[/eluser]
leonglass:

It's the same .htaccess that I've been using on all my earlier projects, so I doubt there's anything wrong with it... Allthough could be wrong!

smith:

Exactly, that's why I thought it was so odd. The real problem though is that it doesn't output anything in the logs _at all_. Judging by the logs it's like no one ever requested a page that gives that Fatal error: output.

I have absolutly no idea what's wrong, except that I know that it finds the controller atleast because if I enter something like http://localhost/askldjlaksdakjd/alskdjl...sldkjaskdj it gives me a


404 Page Not Found

The page you requested was not found.


and as it should.


EDIT:
I've now removed the database library autoload. Still the same Fatal error: could not connect bla bla bla error..... which is really wierd since it's not suppose to be connecting to any databases


EDIT2:
Okay, this is really odd...

I have in my routes

Code:
$route['default_controller'] = "forum";
$route['scaffolding_trigger'] = "";

which on domain-root request (http://localhost/) should load http://localhost/forum and then ofcourse the index function.
That's fine enough, since that's what it does...

But as soon as I add that /forum to specify that it's the forum class I wanna use I get that same message...
#5

[eluser]smith[/eluser]
could it be that you have directory named forum, together with controller named forum?

I am just guessing that you are using CI to rewrite some existing forum, that tries to connect to database...
#6

[eluser]Lockzi[/eluser]
[quote author="smith" date="1192303167"]could it be that you have directory named forum, together with controller named forum?

I am just guessing that you are using CI to rewrite some existing forum, that tries to connect to database...[/quote]


HAHHAHAHAHAHHAHAHAHAHAHHAHAHAHAHHAAHAHAHAAAAHAHHAHAHAA
Seriously, I'm an idiot and you're my hero!

I backed up my work earlier just in case and puted it inside a folder named forum Tongue


Problem solved haha




Theme © iAndrew 2016 - Forum software by © MyBB