title: .htaccesss Remove the File Extension and Variables From the URL
body: <p>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:</p>
  <pre><code>example.com/news/articles.php?id=21&amp;artName=Hello-World
  </code></pre>
  <p>to this :</p>
  <pre><code>example.com/news/articles/21/Hello-World
  </code></pre>
  <p>Currently I have this code in my .htaccess file:</p>
  <pre><code>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&amp;artName=$2 [QSA,L,NC]
  
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI}.php -f
  RewriteRule !\.php$ %{REQUEST_URI}.php [QSA,L]
  </code></pre>
  <p>This is the href link to that article:</p>
  <pre><code>&lt;a href=&quot;https://www.example.com/news/articles/21/Hello-World&quot;&gt;Article&lt;/a&gt;
  </code></pre>
  <p>Whenever I try to go to that page. I get a &quot;Error 404- Not Found&quot; 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.</p>