title: How can I remove and redirect all .php extensions, redirect "www", and remove trailing slashes?
body: <p>I've been trying to remove ".php" from all of the pages on my website, whilst also removing all trailing slashes and "www" from URLs using .htaccess. I have been able to use one or two of these at the same time, but not all. I would really appreciate any help. </p>
  
  <p>For example: </p>
  
  <ul>
  <li>example.com/ to example.com</li>
  <li>www.example.com to example.com</li>
  <li>example.com/index to example.com</li>
  <li>example.com/index.php to example.com</li>
  <li>example.com/chatroom.php to example.com/chatroom</li>
  <li>example.com/directory/ to example.com/directory</li>
  </ul>
  
  <p>I would like to ensure that the old URLs redirects to the new ones, and I don't have any directories that share names with PHP files. In my .htaccess file I also have code blocking particular referrers and specifying 403 and 404 errors. 
  Thank you very much!</p>