2

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?

Cœur
  • 37,241
  • 25
  • 195
  • 267

2 Answers2

4

Too many parentheses. You might have a Lisp infection.

Try:

RewriteRule ^([^/]*)/([^/]*)/?([^/]*)?$ index.php?page=$1&id=$2&action=$3 [QSA,L]
chaos
  • 122,029
  • 33
  • 303
  • 309
1

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

Wick
  • 1,222
  • 2
  • 15
  • 21
gareth_bowles
  • 20,760
  • 5
  • 52
  • 82