Reputation:
I have this code in my .htaccess
file:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-]+)/?$ /admin/index.php?id=$1 [L,QSA]
but when i go to domain.com/admin/properties/add
it should show domain.com/admin/index.php?id=properties/add
but instead it shows 404 page not found
Upvotes: 1
Views: 854
Reputation: 12469
You are specifying a url that contains a
to z
in lower case (a-z
), a
to z
in uppercase (A-Z
), 0
to 9
(0-9
) and a dash -
is to be rewritten, if it doesn't exist. But the url contains a forward slash /
, so you need to include that to the mathing
This should fix that problem and redirect.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-/]+)/?$ /admin/index.php?id=$1 [L,QSA]
Upvotes: 1