Dixen
Dixen

Reputation:

mod_rewrite gives me 404

I wanna rewrite links like index.php?page=entry&id=15&action=edit to entry/15/edit.
This is how my .htaccess looks like now:

# Turn the Rewrite engine on
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

# Rewrite rules
RewriteRule ^([^/]*)(/([^/]*)/?)([^/]*)?$ index.php?page=$1&id=$2&action=$3 [QSA,L]

Gives me 404.

What's the problem?

Upvotes: 2

Views: 886

Answers (2)

gareth_bowles
gareth_bowles

Reputation: 21130

There's a really good one page mod_rewrite cheat sheet here: https://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/

Upvotes: 1

chaos
chaos

Reputation: 124257

Too many parentheses. You might have a Lisp infection.

Try:

RewriteRule ^([^/]*)/([^/]*)/?([^/]*)?$ index.php?page=$1&id=$2&action=$3 [QSA,L]

Upvotes: 4

Related Questions