I know this has been asked many times but no matter what I try I still cannot get my code to work. I have this .htaccess file and I want to redirect my code from this:
example.com/news/articles.php?id=21&artName=Hello-World
to this :
example.com/news/articles/21/Hello-World
Currently I have this code in my .htaccess file:
Options -MultiViews
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteRule ^news/articles/([\w-]+)/(.+) news/articles.php?id=$1&artName=$2 [QSA,L,NC]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
RewriteRule !\.php$ %{REQUEST_URI}.php [QSA,L]
This is the href link to that article:
<a href="https://www.example.com/news/articles/21/Hello-World">Article</a>
Whenever I try to go to that page. I get a "Error 404- Not Found" Page. I am new to editing the .htaccess file so please let me know what I am doing wrong in my code so I can see a successful rewrite in my link, thank you.