Welcome Guest, Not a member yet? Register   Sign In
.htaccess file not redirecting anymore. Possible reasons?
#1

[eluser]Bramme[/eluser]
Hello everybody

This weekend, I got an email from an unhappy client, letting me know that for over two months, they were no longer able to log in to their site or properly visit it, only the homepage was visible (thanks for letting me know now >.< )

So I did some digging and quickly noticed that my .htaccess file was no longer working. URL's visited with index.php/ attached worked fine.

I also had one controller, log.php, which went missing (it was simply gone from the application/controllers folder), though that was just a matter of restoring it from a backup.

Below is my .htaccess file, which I simply picked up here.

Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|(.*)\.swf|uploadify|application|system|assets|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

Anybody got a clue why it would stop working? The host swears that they didn't change anything, but I highly doubt it...
#2

[eluser]Maglok[/eluser]
Well if the host has a tendency to figgle around a bit, some hosts I need to add a . to the / before the index.php in the RewriteRule clause -> RewriteRule ^(.*)$ ./index.php?/$1 [L]

Syntaxwise it looks ok.

Do you know if it is even loading the .htaccess? Mabye try to test that out with a redirect or so at the top see if it is the rewriting itself or not.
#3

[eluser]Bramme[/eluser]
Redirecting clearly works, so the file itself is called. If I'm not mistaken, the RewriteRule is some kind of Apache module? Is it possible that this has been disabled? If so, how could I test this?


edit: I'm pretty certain the Rewrite is still working. I created a test.php file with echo phpinfo() next to my index.php file, but it wasn't called, I had to add the test.php exception to the RewriteCond.

Is it possible the redirect itself is failing within CI? For a second I thought it would have something to do with my _remap function in my frontend controller, but then again, the site still works with full URLS...
#4

[eluser]Maglok[/eluser]
It's not just the RewriteRule, it's a package of stuff that you enable with 'RewriteEngine on'. It's the mod_rewrite apache module.

A quick google says this php might display apache modules:

Code:
if (function_exists('apache_get_modules')) {
  $modules = apache_get_modules();
  $mod_rewrite = in_array('mod_rewrite', $modules);
} else {
  $mod_rewrite =  getenv('HTTP_MOD_REWRITE')=='On' ? true : false ;
}

Probably a buncha ways, but it is the 'mod_rewrite' module for sure.
#5

[eluser]Bramme[/eluser]
Hmm, when I do that and echo $mod_rewrite, I get a false.
#6

[eluser]Maglok[/eluser]
Am not 100% sure, but that would indicate it is either not turned on, or that code is not working properly.

Mabye do a very simple rewrite rule. Then again this is a pretty simple rewriterule. I'd inquire if that module is somehow turned off now or something.
#7

[eluser]Clooner[/eluser]
In your phpinfo you should be able to see if the mod_rewrite module is loaded!
#8

[eluser]Bramme[/eluser]
http://www.vzwhandinhand.be/test.php

You can see for yourself: I don't see any module though :/
#9

[eluser]Clooner[/eluser]
[quote author="Bramme" date="1282744473"]http://www.vzwhandinhand.be/test.php

You can see for yourself: I don't see any module though :/[/quote]

It seems the module is not loaded! Tell your host to re-enable it.
#10

[eluser]Maglok[/eluser]
I checked one of my phpinfo lists and it does list it under apache2handler it has a row of 'loaded modules'. I don't even see that whole heading in your listing. It has to have loaded something. Tongue

I do see a 'additional modules' bit, but that isn't listing it either. Strange stuff.




Theme © iAndrew 2016 - Forum software by © MyBB