Ad

Mod_rewrite Index.php?p=$1

- 1 answer

I'm trying to rewrite index.php?p=page to /page/ but i cant get it to work!

This wont work:

RewriteEngine On

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

RewriteRule .* index.php?p=$1 [PT,L]

Help please!

Ad

Answer

The back-reference $1 does not correspond to a group of the left-hand side of your RewriteRule (groups are defined using parantheses). Try one of the following:

RewriteRule .* index.php?p=$0

# - or -

RewriteRule ^(.*)$ index.php?p=$1
Ad
source: stackoverflow.com
Ad