Reputation: 4803
After 3 days of trying to figure out how to get mod_rewrite working in xampp, I finally tried the CodeIgniter forum. But even they couldn't give me the answer I need. My original post on the CI forum can be found here: http://codeigniter.com/forums/viewthread/221002/
The problem is, I am sure I did everything in order to enable mod_rewrite:
In apache/config/httpd.conf: Uncommented that one line that enabled mod_rewrite module. Replaced every line "AllowOverride None" with "AllowOverride All".
In CI/application/config/config.php:
In CI/application/config/routes.php:
My .htaccess file is located in the same folder where the application folder can be found. The .htaccess file looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /localhost/Tong-Il/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
php_flag short_open_tag off
php_flag magic_quotes_gpc Off
</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>
My site is called Tong-Il, so when I browse to /localhost/Tong-Il/, I get my homepage and everything loads fine (seperate header, footer and menu view + connection to database). But as soon as I click a link anywhere on my homepage, I get the 404 error!
Any link I click will be handled by the "user" controller. So when I press "galery" in my menu, I get the 404 error page with this url: localhost/Tong-Il/user/images. When I change this to localhost/Tong-Il/index.php/user/images it works fine! My website can be found online, but I uploaded it a while ago. Everything is working online (including mod_rewrite), but just to give you an idea: www.tong-il-neeroeteren.be
Is there ANYONE out there that can help me solve this?
Upvotes: 0
Views: 2299
Reputation:
You are setting RewriteBase wrong locally. Instead of
RewriteBase /localhost/Tong-Il/
it should be
RewriteBase /Tong-Il/
Upvotes: 1