Skip to content

Instantly share code, notes, and snippets.

@taricco
Last active September 27, 2024 19:24
Show Gist options
  • Select an option

  • Save taricco/cfbf4c172e434942261e00fcce9150b9 to your computer and use it in GitHub Desktop.

Select an option

Save taricco/cfbf4c172e434942261e00fcce9150b9 to your computer and use it in GitHub Desktop.
# ----------------------------------------------------
# | HTACCESS for WordPress on NameHero |
# | Version: 09/27/24 WWW |
# ----------------------------------------------------
# BEGIN Force SSL
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
</IfModule>
# END Force SSL
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# Protect wp-config.php
<Files wp-config.php>
order allow,deny
deny from all
</Files>
# Protect xmlrpc.php
<Files xmlrpc.php>
order allow,deny
deny from all
</Files>
# Protect .htaccess
<Files .htaccess>
order allow,deny
deny from all
</Files>
# Disable Directory Browsing
Options -Indexes
# END WordPress
php_value memory_limit 512M
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 259200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment