Place this above the # BEGIN WordPress line.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%1/$1 [R=301,L]
Related Posts:
- Masking wp-content/themes/name/images to just images directory using htaccess
- Rewrite rule to load images from production does nothing
- WordPress rewrite rules don’t need ^?
- Adding rewrite rules directly to .htaccess file
- a one-off rewrite rule
- Change htaccess to redirect to index.php in subfolder
- How to remove wordpress directory slash
- Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page
- Map secondary domain to other’s virtual subfolder
- How do I make WordPress revise an .htaccess file a certain way?
- Pretty URL via Rewrite
- ModRewrite not working properly
- Can’t get pretty permalinks to work without index.php
- How to redirect a virtual page (e.g. /blog) to the home page?
- Add rewrite endpoint and .htaccess
- htaccess – Redirect to subfolder without changing browser URL
- How to create custom URL routes?
- Passing parameters to a custom page template using clean urls
- How to add custom rewrite rule to .htaccess?
- Use subdomain for certain urls
- Clash of the rewrites
- How to change default page slug?
- How to map permalinks with accented letters to sanitized slugs?
- Mod_rewrite delete parameter in 301 Redirect
- Hijacking the URL for filtering
- Custom rewrite rules are sending everything to index.php
- Sub domain redirection to taxonomy
- custom htaccess rewrite rule for page
- WordPress Rewrite
- unexpected problem in url rewrite
- Need to make a php file inside theme accessible via url
- Redirecting all old links from previous EE site to new WP site in one go?
- Two “.htaccess” Files Located in Different Directories?
- Evaluating a external rewrite rule before internal wordpress rewrite rule
- Rewrite WordPress Custom URL
- Issue with using .htaccess to redirect feedburner feed
- Custom rewrite rule
- Add query string to url and display it as normal url part /folder/
- WordPress .htaccess – route other URLs to another app
- hard flush_rewrite_rules() not regenerating .htaccess
- Cleanup URL for a custom page in wordpress
- Remove base slug in permalinks of hierarchical custom post type
- Rewrite Rules Are Redirecting and Not Passing VARs
- WordPress SSL (https) is not working with custom permalink
- Changing RSS feed URL structure
- Why is my mod_rewrite not working?
- add_rewrite_rule fro html to another url not working
- NextGEN Gallery Lightbox – Social Share URL Redirect
- Custom rewrite not working
- WordPress .htaccess blocks mine?
- Preserve Domain Alias
- Disable Pagination on Pages
- WordPress Redirecting Non Category Pages /page/nnn to their Canonical URLs
- How can I dynamically generate an image with a static image URL?
- Rewrite wp-login.php URLS to static pages?
- Need help with simple rewrite rule (shouldn’t this be easy?)
- Rewrite custom post type URL parameters
- Cannot access wp-admin without trailing slash – .htaccess configuration for WordPress behind a nginx proxy
- Changed pagination URLS to use p= instead of paged=
- Wildcard forward all posts and pages with few exceptions
- “View post” leads to odd URL
- React Router with WordPress
- joomla to wordpress migration and 404 errors issues [closed]
- Replace specific middle part of url
- Custom Rewrite rule to captured post (rewrite rule to rewrite rule)
- Rewriting a subdomain page on one WordPress installation to a parent domain on another
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- Customise particular RSS permalink
- htaccess rewrite, adding segment to url
- RSS feed rewrite matching wrong rule
- Localize URL bases
- Redirect htaccess [closed]
- WordPress .htaccess ignore path and subsequent .htaccess files in subfolders
- How to customize sub-URLs in a wordpress website (.htaccess)
- Rewriting a date hierarchy into a ‘yyyy-mm-dd’ slug
- modify URL with mod_rewrite or hook
- Rewrite rule that wp-login.php?action=register is left alone
- How to change an existing wordpress page rewrite rule?
- Rewrite htacess rule doesn’t work
- Translatepress taxonomy and custom post type root FIX
- WordPress URL redirect and replace ? question mark
- Multiple permalink with and without category for same post
- Custom Params in URL
- Fresh install redirects to www, breaking page loads
- Rewrite Url using .htaccess or hook
- Is it possible to rewrite a page URL from ID to name from an API?
- Url wordpress rewrite
- Add ReWrite from Old Pages to WordPress (remove .php)
- Fully mask *all* traces of WordPress installation subdirectory?
- .htaccess RewriteRule to include post type and taxonomy
- Redirect A URL Pattern In WordPress Using .htaccess
- URL rewrite results in a 404, but everything should work!
- Rewrite Question
- Stop wordpress to redirecting home page if no page found
- Additional .htaccess rules based on wp page
- Changes done to .htaccess are not getting reverted back
- WordPress total posts per page changed and now 404 Http error comes out [closed]
- how to rewrite folder name in url to another name
- Please give me the rewrite rules for my ugly urls
- WP-Include rewrite directory