title: .htaccess causing 403 Access Denied in Wordpress
body: <p>I have a website for eg. www.example.com which has a custom .htaccess file designed to increase the site speed and make sure that the directory can't be listed.</p>
  
  <p>I have a WordPress installed in the /blog directory i.e; www.example.com/blog/, the blog was working fine till the updated version of the website while after a span of a week the blog stops opening and started showing 403 Access denied. Tried every method available on google <em>I went to the second page of google too</em>. </p>
  
  <p>After an hour I removed the .htaccess of the base directory and my blog is running up and fine again, I was a little curious to know if I will place the .htaccess file again what will happen and after I pushed it back to the server nothing happens to the WordPress site. </p>
  
  <p>But I am afraid this can happen in the near future and hence I need to find out what part of my .htaccess is causing this problem. I still can't access wp-admin.</p>
  
  <p><a href="https://i.stack.imgur.com/bGrZO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bGrZO.jpg" alt="enter image description here"></a></p>
  
  <p>My .htaccess code: </p>
  
  <pre><code>ErrorDocument 404 https://example.com/Error
  ErrorDocument 500 https://example.com/Error
  ErrorDocument 401 https://example.com/Error
  
  &lt;ifModule mod_gzip.c&gt;
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
  &lt;/ifModule&gt;
  
  # START DEFLATE COMPRESSION
  &lt;IfModule mod_deflate.c&gt;
  AddOutputFilterByType DEFLATE "application/atom+xml" \
  "application/javascript" \
  "application/json" \
  "application/ld+json" \
  "application/manifest+json" \
  "application/rdf+xml" \
  "application/rss+xml" \
  "application/schema+json" \
  "application/vnd.geo+json" \
  "application/vnd.ms-fontobject" \
  "application/x-font" \
  "application/x-font-opentype" \
  "application/x-font-otf" \
  "application/x-font-truetype" \
  "application/x-font-ttf" \
  "application/x-javascript" \
  "application/x-web-app-manifest+json" \
  "application/xhtml+xml" \
  "application/xml" \
  "font/eot" \
  "font/otf" \
  "font/ttf" \
  "font/opentype" \
  "image/bmp" \
  "image/svg+xml" \
  "image/vnd.microsoft.icon" \
  "image/x-icon" \
  "text/cache-manifest" \
  "text/css" \
  "text/html" \
  "text/javascript" \
  "text/plain" \
  "text/vcard" \
  "text/vnd.rim.location.xloc" \
  "text/vtt" \
  "text/x-component" \
  "text/x-cross-domain-policy" \
  "text/xml"
  &lt;/IfModule&gt;
  # END DEFLATE COMPRESSION
  
  # START ENABLE KEEP ALIVE
  &lt;ifModule mod_headers.c&gt;
  Header set Connection keep-alive
  &lt;/ifModule&gt;
  # END ENABLE KEEP ALIVE
  
  # START EXPIRES CACHING #
  &lt;IfModule mod_expires.c&gt;
  ExpiresActive On
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresByType image/svg+xml "access plus 1 month"
  ExpiresByType audio/ogg "access plus 1 year"
  ExpiresByType video/mp4 "access plus 1 year"
  ExpiresByType video/ogg "access plus 1 year"
  ExpiresByType video/webm "access plus 1 year"
  ExpiresByType application/atom+xml "access plus 1 hour"
  ExpiresByType application/rss+xml "access plus 1 hour"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType application/javascript "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType text/x-component "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType font/opentype "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
  ExpiresByType application/x-font-ttf "access plus 1 month"
  ExpiresByType application/font-woff "access plus 1 month"
  ExpiresByType application/font-woff2 "access plus 1 month"
  ExpiresDefault "access 1 month"
  &lt;/IfModule&gt;
  # END EXPIRES CACHING #
  
  
  # DISABLE IMAGE HOTLINKIING START
  RewriteEngine on
  RewriteCond %{HTTP_REFERER} !^$
  RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example.com [NC]
  RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?localhost [NC]
  RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
  RewriteRule \.(jpg|jpeg|png|gif)$ â€“ [NC,F,L]
  # DISABLE IMAGE HOTLINKIING END
  
  # ENABLE MOD PAGESPEED START
  # COMBINE CSS, COMPRESS IMAGES, REMOVE HTML WHITE SPACE AND COMMENTS
  &lt;IfModule pagespeed_module&gt;
  ModPagespeed on
  ModPagespeedEnableFilters rewrite_css,combine_css
  ModPagespeedEnableFilters recompress_images
  ModPagespeedEnableFilters convert_png_to_jpeg,convert_jpeg_to_webp
  ModPagespeedEnableFilters collapse_whitespace,remove_comments
  &lt;/IfModule&gt;
  # ENABLE MOD PAGESPEED END
  
  # START â€“ Disable server signature #
  ServerSignature Off
  # END â€“ Disable server signature #
  
  # ENABLE LITESPEED CACHE START
  &lt;IfModule LiteSpeed&gt;
  CacheEnable public
  RewriteEngine On
  RewriteCond %{REQUEST_METHOD} ^GET|HEAD$
  RewriteCond %{HTTP_HOST} ^example.com [NC]
  RewriteCond %{REQUEST_URI} !login|admin|register|post|cron
  RewriteCond %{QUERY_STRING} !nocache
  RewriteRule .* - [E=Cache-Control:max-age=300]
  &lt;/IfModule&gt;
  # ENABLE LITESPEED CACHE END
  
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}.html -f
  RewriteRule ^(.+)$ $1.html [L,QSA]
  
  #Alternate default index page
  DirectoryIndex Home.html
  </code></pre>