htaccess returns $ i

0

Good evening, I made a htacces code like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^app/([0-9]+) app.php?id=$i

The first rule is to remove the ".php" from the pages and the second is that instead of appearing app.php? id = 11 appears app / 11, however when I do the $ _GET ["id"]; it returns the "$ i" that is the variable of the htaccess, someone knows the solution so that it returns the value of the id, in case, I am using alphanumeric ids, for example: 09a6cc

Thank you in advance.

    
asked by anonymous 03.07.2018 / 06:31

1 answer

1

Switch to this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteRule ^app/(.*)$ app.php?id=$1

In this case, you have put $ i instead of $ 1. And also, this allows alphanumeric.

    
03.07.2018 / 08:10