php - convert .htaccess to web.config iis 10
one text
Good evening, I should convert this .htaccess file to web.config, I tried to import it into UrlRewrite but when I open the pages it gives me 404, and I need .php at the end, I would like to remove it for all the pages present
RewriteEngine On
RewriteRule ^p/(.*)$/?$ post.php?user=$1 [NC,L]
RewriteRule ^register register.php [NC,L]
RewriteRule ^login login.php [NC,L]
RewriteRule ^u messages.php [NC,L]
I rewrote all the urls, the only one I can't rewrite is the url that generates post registration, which would be this https://example.com/u/username/view
(view refers to a page called messages.php
) and the starting code is this:
//save user data to DB
$statement = $pdo->prepare("INSERT INTO tbl_users (username,password,email) VALUES (?,?,?)");
$statement->execute(array($username,md5($password),$email));
$_SESSION['user'] = $username;
header("location: ".BASE_URL.'u/'.$username.'/view');
}else{
header("location: ".BASE_URL);
}
and the code in .htaccess
is this:
RewriteRule ^ u messages.php [NC, L]
Source