Answers.Body: <p>It might be down to the order you have the code in your htaccess file? Did you try putting your code above the Craft rewrite code?</p>
  
  <pre><code># redirect PHP or HTM to no extension
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.(php|htm?)
  RewriteRule ^ /%1 [L,R=301]
  
  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  </code></pre>
  
  <p>Also I tend to exclude certain directories when I don't want rewrites to apply. One way to do this would be;</p>
  
  <pre><code># ------------------------------------------------------------------------------
  # | Exclude directories from the rewrite rules                                 |
  # ------------------------------------------------------------------------------
  RewriteRule ^craft - [L]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-19T13:37:54.340Z
Answers.LastActivityDate: 2016-08-19T13:37:54.340Z
Answers.UserDisplayName: Terry Upton
Body: <p>I was getting an 'unknown error' when trying to access the admin. I couldn't see anything in the Craft logs apart from 404 related errors.
  I replaced the app folder but still no luck, eventually I discovered it was a rewrite rule in my <code>.htaccess</code> causing the problem.</p>
  
  <pre><code># redirect PHP or HTM to no extension
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.(php|htm?)
  RewriteRule ^ /%1 [L,R=301]
  </code></pre>
  
  <p>I'd love to understand why, and how I can get around this in the future?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-19T14:00:42.120Z
Comments.Text: Out of interest - why are needing to do this? Craft can handle this for you.
Comments.UserDisplayName: Luke Pearce
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-19T14:05:54.417Z
Comments.Text: I didn't know it could! Can you point me to where to look?
Comments.UserDisplayName: sarah3585
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-19T14:13:22.407Z
Comments.Text: It won't handle it per say but the convention when building a Craft site is to generally not use `php` files (http://craftcms.stackexchange.com/questions/722/can-we-use-php-in-our-templates-instead-of-twig). For `htm` you can just rename these to `html` and the extension will be removed automatically if placed in the `template` directory.
Comments.UserDisplayName: Luke Pearce
Tags: <error><htaccess>
Title: 'Unknown error' caused by redirect in htaccess
ThreadText: # 'Unknown error' caused by redirect in htaccess
  
  (Asked by: username_0 on 2016-08-19)
  
  I was getting an 'unknown error' when trying to access the admin. I couldn't see anything in the Craft logs apart from 404 related errors.
  I replaced the app folder but still no luck, eventually I discovered it was a rewrite rule in my `.htaccess` causing the problem.
  
  ```
  # redirect PHP or HTM to no extension
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.(php|htm?)
  RewriteRule ^ /%1 [L,R=301]
  
  ```
  
  I'd love to understand why, and how I can get around this in the future?
  
  **Tags:** error, htaccess
  
  > **Comments:**
  > **username_1**: Out of interest - why are needing to do this? Craft can handle this for you.  
  > **username_0**: I didn't know it could! Can you point me to where to look?  
  > **username_1**: It won't handle it per say but the convention when building a Craft site is to generally not use `php` files (http://craftcms.stackexchange.com/questions/722/can-we-use-php-in-our-templates-instead-of-twig). For `htm` you can just rename these to `html` and the extension will be removed automatically if placed in the `template` directory.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-08-19. Score: 2
  
  It might be down to the order you have the code in your htaccess file? Did you try putting your code above the Craft rewrite code?
  
  ```
  # redirect PHP or HTM to no extension
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.(php|htm?)
  RewriteRule ^ /%1 [L,R=301]
  
  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  
  ```
  
  Also I tend to exclude certain directories when I don't want rewrites to apply. One way to do this would be;
  
  ```
  # ------------------------------------------------------------------------------
  # | Exclude directories from the rewrite rules                                 |
  # ------------------------------------------------------------------------------
  RewriteRule ^craft - [L]
  
  ```
  
  
  ---
  
  