I'm learning to maintain my own WP site. After a lot of reading I ended up with my "complete" htaccess file that looks something like this
DirectoryIndex index.php
# Disable directory listings
Options -Indexes
# PROTECT htaccess file
<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>
# PROTECT WP-CONFIG
<Files wp-config.php>
Order Allow,Deny
Deny from all
</Files>
# Block Hotlinking
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} \.(jpeg|jpg|png)$ [NC]
RewriteCond %{HTTP_REFERER} !^http://([^.]+\.)?example\. [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteRule \.(gif|jpeg|jpg|png)$ http://example.com/wp-content/images/hotlink.jpg [F,NC,L]
</ifModule>
# redirect Mobile from Blogger
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} ^m=1$
RewriteRule (.*) $1? [R=301, L]
</IfModule>
# Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Most of it is composed by copying, adapting and pasting code from various sources. Since I'm a self-taught newbie, I have the following questions:
Does the order of the code snippets play a role? Is it correct in the above example?
Are all these repetitive
<IfModule mod_rewrite.c> RewriteEngine On ... </IfModule>
correct, or should one somehow combine them and avoid multiple calls to it?