I'm struggling to convert .htaccess rule into PHP regex if statement, here's the rule as it is in htaccess
RewriteRule ^user/([a-zA-Z0-9-]+)$ user.php?slug=$1 [L]
Now for PHP I've tried several ways, as i'm not too good with REGEX nothing seems to work.
if(preg_match("#user\/(a-z_\-0-9)\$#",$request)) {
exit("okKKKKKK");
} else {
exit("no");
}
$request is "/user/test-user" anyone could give me a hand?