Afshin Izadi
Afshin Izadi

Reputation: 526

How to rewrite URL in .htaccess, whats wrong here

think the user enter

localhost/app/public/anything/anything/index/php/id/5

then id like to change it to the

localhost/app/public/index.php?id=5

the expression that i wrote is this

RewriteRule ^index/php/id/([0-9]+)$ http://localhost/saecms/public/index.php?id=$1 [L]

but it doesn't work, whats wrong here? thank you

Upvotes: 1

Views: 65

Answers (1)

anubhava
anubhava

Reputation: 785156

You can use this rule in your /app/public/.htaccess file:

RewriteEngine On
RewriteBase /app/public/

RewriteRule (?:^|/)index.php/id/(\d+)/?$ index.php?id=$1 [L,QSA,NC]

Upvotes: 1

Related Questions