views:

71

answers:

3
RewriteEngine on
RewriteCond $1 !^(index\.php|files|assets|robots\.txt)
RewriteRule ^(.*)$ ./index.php/$1 [L]

The website is hosted on the latest version of XAMPP locally. When I load the website with the .htaccess file in place, it won't load at all. I get a server error

What am I doing wrong?

EDIT: Checked log file, here's an error that might help point the issue out. Does this mean that mod_rewrite has not been included?

.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or 
defined by a module not included in the server configuration
+1  A: 

Change your first line to

RewriteEngine On

Also, replace your RewriteRule with

RewriteRule ^(.*)$ index.php/$1 [L]

If this doesn't help, check your log file. Server errors will normally issue something to the log file.

If that doesn't help, you'd best crank up your RewriteLog and post some of that here.

Artelius
+1  A: 

The first line, as has been pointed out, should be changed :

RewriteEngine On

but you really ought to redirect requests only if they do not already exists (otherwise all your static requests, eg images and css, would go through index.php as well)

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
K Prime
+1  A: 

Have you made sure to enable mod_rewrite in XAMPP? A quick googling revealed that (at least in older versions of XAMPP), mod_rewrite was not enabled by default. Maybe this is your issue?

jkndrkn