문제

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

도움이 되었습니까?

해결책

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]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top