Update: Although this answer has been accepted a few years ago, note that its approach is now recommended against by the Apache documentation. Use a Redirect
instead. See this answer.
RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Related Posts:
- Redirect www to non-www htaccess
- Redirect from https to http or from http to https? [closed]
- How to use https on one page only?
- Any any insecure http:// URLs left in wordpress?
- Understanding Redirects
- Specific Page/Post Need to Stay Non SSL
- Redirect HTTP request to HTTPS request
- SSL Error: unable to get local issuer certificate
- Why am I suddenly getting a “Blocked loading mixed active content” issue in Firefox?
- Https to http redirect using htaccess
- Why is WordPress redirecting from http to https on a local environment?
- Is there a way to force ssl on certain pages
- Stop WordPress and Plugins from Overwriting .htaccess
- Force HTTPS using .htaccess – stuck in redirect loop
- How to redirect url requests to https? [closed]
- 302 redirect instead of 301 after switch to HTTPS
- How are both HTTP and HTTPS versions displaying?
- Redirect to https not working with .htaccess [closed]
- Menu links only using http after enabling https, unable to redirect http links
- Cant Access Website – Changed HTTP to HTTPs
- https multiple redirects
- some url does not redirect from http to https
- https redirect (with .htaccess) redirect loop
- How to set up htaccess to redirect a particular post type or subdirectory to HTTPS?
- Using HTACCESS for Secret Access
- Redirect http to https does not work on subdir where another instance of WordPress installed
- 403 error on admin login page
- What is the right way to redirect all traffic to HTTPS?
- Htaccess file isn’t redirecting http sub-pages to https––they display 404 error instead, tried many solutions and none work
- Redirect HTTP to HTTPS for all sub domains (blog posts)
- 301 redirection editing .htaccess doesn’t work
- WordPress keeps redirecting subpages without http to https homepage after switch
- .htaccess 301 redirect conflict with plugin “WordPress Https”
- ReDirect subfolder link to another sub-folder and force SSL
- Htaccess https 301 problem
- How to make my site use HTTPS for images or how to insert images as relative paths?
- 404/500 error on content images if Referer header is from another domain [closed]
- My site doesn’t redirect from HTTP to HTTPS
- HTTPS to HTTP rewrite rules not working as expected
- Redirecting specific sites to HTTP in WordPress Multisite
- WordPress site not forcing from http to https instead getting redirected too many times
- Moving site from HTTP to HTTPS
- My site thinks it’s secure when it is fact not
- WordPress HTTPS – ‘… better to use HTTP for installation …’
- Nice font not working when http to https – SSL Issue
- Best way to redirect all HTTP to HTTPS in IIS
- How to force HTTP and stop SSL completey on WordPress website
- Does WordPress automatically redirect to the URL specified in settings?
- When you use ‘badidea’ or ‘thisisunsafe’ to bypass a Chrome certificate/HSTS error, does it only apply for the current site? [closed]
- When you use ‘badidea’ or ‘thisisunsafe’ to bypass a Chrome certificate/HSTS error, does it only apply for the current site? [closed]
- What is the difference between a cer, pvk, and pfx file?
- How to solve “Kernel panic – not syncing – Attempted to kill init” — without erasing any user data
- What’s the best approach for generating a new API key?
- @ converted to %40 in HTTPPost request
- What does HTTP/1.1 302 mean exactly?
- Is it possible to decrypt SHA1
- Custom Tumblr theme wont save because of non-https urls?
- Simplest two-way encryption using PHP
- Why does the URL http://a/%%30%30 crash Google Chrome?
- Access-Control-Allow-Origin Multiple Origin Domains?
- htaccess – Redirect to subfolder without changing browser URL
- what is a auth_user_file.txt?
- Mixed Content Page: requested an insecure stylesheet error
- How do you redirect HTTPS to HTTP?
- When you use ‘badidea’ or ‘thisisunsafe’ to bypass a Chrome certificate/HSTS error, does it only apply for the current site?
- Getting “Handshake failed…unexpected packet format” when using WebClient.UploadFile() with “https” when the server has a valid SSL certificate
- ndroid 8: Cleartext HTTP traffic not permitted
- How does the SQL injection from the “Bobby Tables” XKCD comic work?
- Error `sec_error_revoked_certificate` when viewed in Firefox only
- How to view PHP on live site
- Convert .pfx to .cer
- how fix “this certificate cannot be verified up to a trusted certification authority”
- Can an attacker use inspect element harmfully?
- Where does Internet Explorer store saved passwords?
- How can bcrypt have built-in salts?
- Generic htaccess redirect www to non-www
- Redirect old php link to wordpress link in .htaccess
- Redirect old php link to wordpress link in .htaccess
- Safely redirect old WordPress blog links to new WP blog
- Double slashes on WordPress Admin URL redirects to wp-login
- Cant login to wp-admin (redirecting to homepage), But CAN login to wp-login.php
- Cant login to wp-admin (redirecting to homepage), But CAN login to wp-login.php
- Is moving wp-config outside the web root really beneficial?
- Hide the fact a site is using WordPress?
- Verifying that I have fully removed a WordPress hack?
- Infected Files – what to do [closed]
- Getting a List of Currently Available Roles on a WordPress Site?
- WordPress 4.7.1 REST API still exposing users
- Can I Prevent Enumeration of Usernames?
- Best way to eliminate xmlrpc.php?
- What’s the easiest way to stop WP from ever logging me out
- “Too many redirects” ONLY when trying to access wp-admin page
- If a hacker changed the blog_charset to UTF-7 does that make WordPress vulnerable to further attacks?
- How do I skip wordpress’s 404 handling and redirect all 404 errors for static files to 404.html?
- Should I escape wordpress functions like the_title, the_excerpt, the_content
- Why should I use the esc_url?
- Should I remove install.php and install-helper.php?
- Prevent access or auto-delete readme.html, license.txt, wp-config-sample.php
- How safe / sanitized is wp_insert_posts()?
- Why does WordPress need my private ssh key to update?