Title: ErrorDocument doesn&#8217;t work
Last modified: March 15, 2021

---

# ErrorDocument doesn’t work

 *  Resolved [rpost](https://wordpress.org/support/users/rpost/)
 * (@rpost)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/errordocument-doesnt-work/)
 * Hello. My .htaccess config is using redirecting rules (HTTP -> HTTPS). I think
   error logging (403.php) doesn’t work because of this redirecting rules.
 * I have shortened the .htaccess file for the example:
 *     ```
       ErrorDocument 403 /wp-content/plugins/bulletproof-security/403.php
   
       RewriteEngine On
       RewriteBase /
   
       # For example disable .log files
       <IfModule mod_rewrite.c>
         RewriteCond %{REQUEST_URI} (\.log)
         RewriteRule .* - [F,L]
       </IfModule>
   
       # Redirecting rules HTTP to HTTPS
       <IfModule mod_rewrite.c>
         RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
         RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
         RewriteCond %{HTTPS} off
         RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}  [R=301,L]
       </IfModule>
       ```
   
 * 1) [https://example.com/test.log](https://example.com/test.log) -> Works fine.
   
   2) [http://example.com/test.log](http://example.com/test.log) -> Doesn’t work.
 * Please have a look at my screenshot:
 * [[
    -  This topic was modified 5 years, 2 months ago by [rpost](https://wordpress.org/support/users/rpost/).
    -  This topic was modified 5 years, 2 months ago by [rpost](https://wordpress.org/support/users/rpost/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferrordocument-doesnt-work%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/errordocument-doesnt-work/#post-14203559)
 *     ```
       RewriteCond %{REQUEST_URI} (\.log)
       RewriteRule .* - [F,L]
       ```
   
 * The way you are using this code above it will always generate a 403 error since
   the F flag = forbidden. The ErrorDocument directive is basically a “built-in”
   redirect. So you would just add a path to a logging file. ie the BPS 403.php 
   error logging file. So basically it looks like you are doing something redundant
   that does not need to be done with your code above.
    -  This reply was modified 5 years, 2 months ago by [AITpro](https://wordpress.org/support/users/aitpro/).
    -  This reply was modified 5 years, 2 months ago by [AITpro](https://wordpress.org/support/users/aitpro/).
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/errordocument-doesnt-work/#post-14228997)
 * I think I misunderstood what you were asking. I think you simply are trying to
   get an HTTP redirect to go to HTTPS? Try the Rewrite htaccess code below first.
   You may need to create a DNS CNAME record to get HTTP URL’s to redirect to HTTPS
   URL’s. Example: `CNAME www.forum forum.ait-pro.com`, but that would depend on
   how your SSL Certificate TLD is setup. Anyway these are all the things you need
   to consider to figure out the problem.
 * Try this code below > [https://forum.ait-pro.com/forums/topic/wordpress-ssl-htaccess-code-rewrite-ssl-rewritecond-server_port/#post-7233](https://forum.ait-pro.com/forums/topic/wordpress-ssl-htaccess-code-rewrite-ssl-rewritecond-server_port/#post-7233)
 *     ```
       # WP REWRITE LOOP START
       RewriteEngine On
       RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
       RewriteBase /
       RewriteCond %{HTTPS} !=on
       RewriteCond %{SERVER_PORT} ^80
       RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
       RewriteRule ^index\.php$ - [L]
       ```
   
    -  This reply was modified 5 years, 2 months ago by [AITpro](https://wordpress.org/support/users/aitpro/).
 *  Plugin Author [AITpro](https://wordpress.org/support/users/aitpro/)
 * (@aitpro)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/errordocument-doesnt-work/#post-14239714)
 * Since this is not a BPS plugin question and it’s been a while since you responded
   then I’m going to resolve this thread.
 * Also wanted to mention that if you do want to use the BPS plugin as an htaccess
   file manager and editor you would use the BPS Custom Code feature to create customized
   htaccess files.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘ErrorDocument doesn’t work’ is closed to new replies.

 * ![](https://ps.w.org/bulletproof-security/assets/icon-128x128.png?rev=1731938)
 * [BulletProof Security](https://wordpress.org/plugins/bulletproof-security/)
 * [Support Threads](https://wordpress.org/support/plugin/bulletproof-security/)
 * [Active Topics](https://wordpress.org/support/plugin/bulletproof-security/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bulletproof-security/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bulletproof-security/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [AITpro](https://wordpress.org/support/users/aitpro/)
 * Last activity: [5 years, 2 months ago](https://wordpress.org/support/topic/errordocument-doesnt-work/#post-14239714)
 * Status: resolved