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
  • 34,719
  • 24
  • 185
  • 251

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
  • 119,149
  • 33
  • 300
  • 308
1

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

Wick
  • 1,192
  • 2
  • 14
  • 21
gareth_bowles
  • 20,301
  • 5
  • 56
  • 81