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
- When you use ‘badidea’ or ‘thisisunsafe’ to bypass a Chrome certificate/HSTS error, does it only apply for the current site? [closed]
- Mixed Content Page: requested an insecure stylesheet error
- Redirect old php link to wordpress link in .htaccess
- WordPress Redirect All HTTP requests to HTTPS via .htaccess
- Securing wp-admin folder – Purpose? Importance?
- 301 redirect not working through .htaccess
- Moving wordpress out of the public directory
- multisite htaccess 301 redirects
- W3 Total Cache Plugin with WP 3 MultiUser [closed]
- How can I tell who changed the password?
- WordPress website Security [closed]
- Using “wordpress_logged_in” to restrict direct access to uploads folder in 2021
- Is the “lost password” feature truly a vulnerability?
- Can WordPress redirect to a “similar page” in case of 404 error
- Is it possible to reduce the minimum character length for passwords?
- Why was my blog post inserted lot’s of ad links by others?
- Should I Worry About SQL Injection When Using wp_insert_post?
- htaccess 301 Redirect not working for WordPress site
- Security threat with `home_url`?
- Redirect only posts to New Domain
- When is wp_set_password() called or how to capture a password
- Redirect an old link to new site homepage [closed]
- How to get WordPress to send Password Reset Link Email instead of New Password?
- Multisite Redirection to new domains
- How much should I worry about these messages?
- Security concerns with external links
- Uploading .webm format on WordPress results in security guidline breach and fail
- .htaccess password protection bypassed
- How to convert srcset links from https to http?
- How to allow download url redirection only if user logged in WordPress site?
- Prevent editor from adding script or form
- redirecting an entire WP site from one top level domain to another
- Configuring Home Page Address
- Finding where a snippet of code is coming from
- Remove hacked code – out of ideas! [closed]
- What’s the best way to manage a lot of 301 redirects in WordPress?
- Website Migration (with https) to a new domain(http)
- Staging Session Randomly Switched from Secure (https) to Not Secure
- Loading /wp-content/uploads/site as /site/
- Security: Critical backend outside of wordpress
- Advice On How to Backup WordPress
- How to fix this CORS error?
- Using the JSON API via HTTPS and HTTP
- Why is http header providing 404 while site is online?
- Redirecting a POST to a php script
- WordPress exploited theme is causing high io load on server
- Removed and Reinstalled WordPress, Redirect Broken now
- Why are all pages redirecting to homepage when using custom permalinks?
- How to set custom validation for WordPress Passwords?
- .htaccess regex for redirect subdomain to root domain & redirect old permalinks
- How can I implement ansible with per-host passwords, securely?
- How to get Apache2 to redirect to a subdirectory
- how to sanitizing $_POST with the correct way?