title: Remove .php from urls with htaccess
body: <p>EDIT: current .htaccess file:</p>
  
  <pre><code>Options +FollowSymLinks -MultiViews
  # Turn mod_rewrite on
  RewriteEngine On
  RewriteBase /
  
  ## hide .php extension snippet
  
  # To externally redirect /dir/foo.php to /dir/foo
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
  RewriteRule ^ %1 [R,L]
  
  # To internally forward /dir/foo to /dir/foo.php
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{DOCUMENT_ROOT}/$1.php -f
  RewriteRule ^(.*?)/?$ $1.php [L]
  </code></pre>
  
  <p>My site is hosted in a subfolder of a domain connected to a large hosting account.</p>
  
  <pre><code>basesite
    /iioengine
      /forums
        /.htaccess //file works
        /.... //other MyBB content
      /demos.php
      /index.php //iioengine.com (homepage)
      /.htaccess //file doesn't work
      /... //other iioengine php pages
  </code></pre>
  
  <p>Is the issue that I'm using two different htaccess files?</p>
  
  <p>Here is a link that needs to work: <a href="http://iioengine.com/demos" rel="nofollow noreferrer">http://iioengine.com/demos</a></p>
  
  <p>I noticed that this current htaccess file disrupts all of the forums URL's as well</p>
  
  <p>This no longer works: <a href="http://iioengine.com/forums/Forum-Box2D" rel="nofollow noreferrer">http://iioengine.com/forums/Forum-Box2D</a></p>
  
  <p>EDIT: Thanks for reopening, I have made some progress. Here is my current htaccess file:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>I still get 404 pages, but if I put this line in:</p>
  
  <p><code>RewriteRule . /index.php [L]</code></p>
  
  <p>all non-'.php' requests get forwarded to the homepage... So mod_rewrite is definitely enabled, it's just not working right. Anyone know what the issue could be? </p>
  
  <p><strong>EDIT</strong>: This is <strong>not a duplicate</strong> - none of the other solutions work for me. My question is not <em>do solutions exist</em>, its <em>why aren't they working for me</em>. No one has been able to resolve this, I have been trying many solutions myself. Isn't the point of this forum to get solutions to specific issues?</p>
  
  <p>Allow me to clarify...</p>
  
  <p>I have MyBB running in a subfolder and its rewrites work fine. This link, for instance, works: <a href="http://iioengine.com/forums/Forum-Box2D" rel="nofollow noreferrer">http://iioengine.com/forums/Forum-Box2D</a></p>
  
  <p>All the php pages that are not part of MyBB still have the .php extension in their URLs - I am trying to remove these but nothing is working. Example: <a href="http://iioengine.com/demos" rel="nofollow noreferrer">http://iioengine.com/demos</a></p>
  
  <p>... [original post]</p>
  
  <p>There is obviously a lot of information out there about this, but I have tried almost a dozen different solutions and have not gotten past a 404 page.</p>
  
  <p>Here is my site: <a href="http://iioengine.com/" rel="nofollow noreferrer">http://iioengine.com/</a>, all pages are php, and everything other than the homepage and all of the forums pages have a '.php' at the end of their URL that I would like to remove.</p>
  
  <p>In addition to redirecting non-'.php' requests to the correct pages, I would also like to remove the '.php' part even when it is part of the request (because all of my content already specifies '.php' in its hyperlinks).</p>
  
  <p>This is what I have so far, mostly taken from <a href="https://stackoverflow.com/questions/9821222/remove-php-extension-explicitly-written-for-friendly-url">this post</a>, but it doesn't work, I get a 404 page.</p>
  
  <pre><code>RewriteEngine on
  RewriteBase /
  RewriteCond %{SCRIPT_FILENAME} !-d
  RewriteCond %{SCRIPT_FILENAME} !-f
  RewriteRule ^(.*)$ $1.php [L,QSA]
  RewriteCond %{REQUEST_URI} ^/(.*).php$
  RewriteRule ^(.*)$ %1 [L,QSA]
  </code></pre>
  
  <p>what do I need in my htaccess file to remove the file extension from the URL in all cases? Thanks</p>