The all famous mod_rewrite issue |
[eluser]selman555[/eluser]
All famous because so many people are having problems figuring it out! Hi by the way. Could someone please explain to me what I need to do in the following situation: I developed my website in CI on localhost via xampp. When the site was finished, I copied the site to my webdomain and got it right up to the point that mod_rewrite worked online. I lost my offline project, so now I recopied the website from my domain to my xampp (which was also reinstalled -> new pc). I already added the .htaccess file: Code: <IfModule mod_rewrite.c> I also uncommented LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf and replaced all AllowOverride None to All. Also: Code: $config['base_url'] = ''; When I load the page in xampp via localhost/Tong-Il/, I get the homepage, but when clicking any link, it says 500 internal server error: Code: Server error! The site can be found online at www.tong-il-neeroeteren.be Help!?
[eluser]selman555[/eluser]
[quote author="Jeroen Schaftenaar" date="1342549812"]What do the log files say? [/quote] Does ci save these errors with a description? I don't know, because my application/logs folder is empty. I don't have error handling for this kind of error as I don't know where this error is generated.
[eluser]Clooner[/eluser]
Mod_rewrite is a web server issue, try looking at those...
[eluser]selman555[/eluser]
[quote author="Jeroen Schaftenaar" date="1342550403"]Mod_rewrite is a web server issue, try looking at those...[/quote] Not sure what I should look at. When I started my project the first time, I got it working on xampp and on the domain. Now I don't remember what settings I have to change in order for mod_rewrite to work with xampp.
[eluser]Clooner[/eluser]
[quote author="selman555" date="1342550731"][quote author="Jeroen Schaftenaar" date="1342550403"]Mod_rewrite is a web server issue, try looking at those...[/quote] Not sure what I should look at. When I started my project the first time, I got it working on xampp and on the domain. Now I don't remember what settings I have to change in order for mod_rewrite to work with xampp.[/quote] In the apache log files, there it will say exactly why it gives the 500 error!
[eluser]selman555[/eluser]
[quote author="Jeroen Schaftenaar" date="1342557797"][quote author="selman555" date="1342550731"][quote author="Jeroen Schaftenaar" date="1342550403"]Mod_rewrite is a web server issue, try looking at those...[/quote] Not sure what I should look at. When I started my project the first time, I got it working on xampp and on the domain. Now I don't remember what settings I have to change in order for mod_rewrite to work with xampp.[/quote] In the apache log files, there it will say exactly why it gives the 500 error![/quote] I checked the apache logs, but there's no reference to the 500 errors. Recently, I found out that I can access all of my pages using the index.php suffix. Pretty stupid of me not to check that first, so now the only problem left is mod_rewrite. the index.php should be rewritten, but now I always get the object not found error. The only page that does work without the index.php suffex in my homepage or indexpage... Any suggestions on that?
[eluser]Clooner[/eluser]
[quote author="selman555" date="1342559935"][quote author="Jeroen Schaftenaar" date="1342557797"][quote author="selman555" date="1342550731"][quote author="Jeroen Schaftenaar" date="1342550403"]Mod_rewrite is a web server issue, try looking at those...[/quote] Not sure what I should look at. When I started my project the first time, I got it working on xampp and on the domain. Now I don't remember what settings I have to change in order for mod_rewrite to work with xampp.[/quote] In the apache log files, there it will say exactly why it gives the 500 error![/quote] I checked the apache logs, but there's no reference to the 500 errors. Recently, I found out that I can access all of my pages using the index.php suffix. Pretty stupid of me not to check that first, so now the only problem left is mod_rewrite. the index.php should be rewritten, but now I always get the object not found error. The only page that does work without the index.php suffex in my homepage or indexpage... Any suggestions on that?[/quote] If you get a 404 it could be that your mod_rewrite is not enabled, as you set it up to display a 404 when mod_rewrite is not enabled. Also try using it without the question mark in this Code: RewriteRule ^(.*)$ index.php?/$1 [L] Code: RewriteRule ^(.*)$ index.php/$1 [L]
[eluser]selman555[/eluser]
[quote author="Jeroen Schaftenaar" date="1342560252"] If you get a 404 it could be that your mod_rewrite is not enabled, as you set it up to display a 404 when mod_rewrite is not enabled. Also try using it without the question mark in this Code: RewriteRule ^(.*)$ index.php?/$1 [L] Code: RewriteRule ^(.*)$ index.php/$1 [L] Not enabled? If I recall correctly, I should just uncomment a line and replace allowoverride none with allowoverride all in httpd.conf so that xampp settings can be overwritten with .htaccess files. The .htaccess file I posted here is the one I used on my old pc, where it worked just fine. I also tried your suggestion and deleted the "?", but i'm still getting the 404 error. I think i'm going to give up!
[eluser]Aken[/eluser]
Your RewriteBase is probably wrong. It doesn't use URLs, it uses paths. Try a simple .htaccess: Code: RewriteEngine On You might need to adjust $config['uri_protocol'] if the .htaccess alone doesn't work. Might also need to add the ? into the RewriteRule - it all depends on your setup. Try stuff, see what works. |
Welcome Guest, Not a member yet? Register Sign In |