====== Apache Web Server Links & Tips ====== ====== Links ====== * [[https://httpd.apache.org/docs/current/|Apache Documentation]] * [[https://httpd.apache.org/docs/current/mod/mod_rewrite.html|Rewrite* Directives (RewriteCond, RewriteOptions, RewriteRule, etc.)]] * [[https://www.the-art-of-web.com/system/rewrite/|RewriteRule Examples]] * [[https://www.askapache.com/htaccess/http-https-rewriterule-redirect/|Smart HTTP and HTTPS .htaccess Rewrite]] * [[http://httpd.apache.org/docs/current/upgrading.html|Upgrade Tips]] ====== Tips ====== ===== Redirect to https if the request is not from localhost ===== RewriteEngine On RewriteCond %{HTTPS} !on RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$ RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA] {{tag>apache}}