The .htaccess
file allows you to control many Apache settings for your site.
Common Uses:
- Force HTTPS:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] - Redirect URLs:
Redirect 301 /old-page.html /new-page.html
- Block IPs:
deny from 123.456.789.000
Note: Make a backup before editing .htaccess
. Errors can cause site issues.