Unfortunately on wordpress.com hosted sites, the www is automatically removed.
For self-hosted wordpress installs, there are several ways to do this.
In .htaccess
file using something like:
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} !^(www\.|$) [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
or set values for WordPress address and Site address in the WordPress Admin Dashboard:
Settings > General
or define in your wp-config.php
file:
define('WP_HOME',"http://www.example.com");
define('WP_SITEURL',"http://www.example.com");
or in your theme functions.php
file or a plugin.
I think your issue might be one of the above is conflicting with your changes which then causes a redirect loop.
Related Posts:
- WordPress site hacked. Has .htaccess been hacked?
- .htaccess and 500 error, extra character added
- Place static HTML files in path below WordPress page
- Static raw HTML page
- htaccess rewrite for author query string when WP is in subfolder
- Why “Settings->Permalinks” creates .htaccess file on nginx server?
- .htaccess for wordpress inside another wordpress install
- .htaccess file redirecting to parent directory
- Rewrite /?rest_route=/ link to /wp-json/ without changing default permalink structure in apache
- Globally force SSL on all pages
- Rewrite rule not working
- Correct htaccess to display page while also passing in GET parameters
- Using “wordpress_logged_in” to restrict direct access to uploads folder in 2021
- Temporary .htaccess blocking is disabling WP Crons from running?
- .htaccess redirects disappeared after re-saving permalinks
- How have I misconfigured basic auth for my wordpress site?
- WordPress trims off the forward slash when import
- WordPress best solution shared theme for consumers and businesses (two url’s one instaltion)
- Redirect main domain to subdirectory
- WordPress multilingual website domain and folders
- Attach to wp-login.php and xmlrpc.php
- Removing code added to htaccess with insert_with_markers
- WordPress 404 on Subdomain
- XMLRPC filtering through htaccess not working
- Corrupt .htaccess file
- Cache policy not updated according to PageSpeed
- Can’t Access Subdirectory
- What’s the opposite of required valid user in .htaccess authentication
- How can i redirect one url to another url using .htaccess or add_rewrite_rule
- When is it necessary to have Header unset Vary in .htaccess
- Redirect http to https does not work on subdir where another instance of WordPress installed
- redirect the homepage using .htaccess outside of WordPress
- Https Redirect infinite loop in Mobile browsers
- 403 error on admin login page
- Redirect an old link to new site homepage [closed]
- HTTP Error 406 always on site?
- Point all URLs to homepage but maintain URL
- .htaccess rewriting old RSS feed URL to WordPress feed URL
- How can I set Cache TTL for woff and woff2 font files with htaccess?
- htaccess working on local server but not on live server
- How can I fix the redirect chain after implementing ssl on wordpress?
- External content won’t load in iframe in Safari
- How to write .htaccess so that https is on for subpages only but not the home page
- How do I configure wordpress structure for development using git and composer
- How to create a redirect in the .htaccess file, with 2 exceptions
- Custom rewrite rule, url returning 404
- My Homepage Suddenly Disappeared and I Can’t Get It Back
- mod_rewrite doesn’t work as I want even with JSON API Plugin disabled
- How to turn this .htaccess rule into a dynamic rule with add_rewrite_rule, et al?
- WordPress .htaccess file gives issues with subdirectory
- W3 Total Cache CSS & JS files GZip issues [closed]
- WP Super Cache unable to locate cache file for only the homepage
- Disable directory browsing of uploads folder
- Cannot login to WordPress site after changing .htaccess for security purposes
- WordPress permalink, stop redirection
- add_rewrite_rule to remove /category/ from permalink
- Local PC cache stays filled with old WordPress Site data
- How to have a custom URI path for specific page template
- WordPress JSON API restrict to specific domain
- Where to put W3 Total Cache rewrite rules in .htaccess? [closed]
- Non WordPress Folder in a WordPress Site
- Htaccess rewrite based on query string, not working [closed]
- Redirect all subdomains to root domain
- Rewrite Rules not redirecting rewrite
- How do i allow access to a single file in my root directory? [closed]
- Change root directory
- Selectively Disabling PHP via .htaccess in Root Directory
- How to execute WordPress as though it is in the root folder while it is installed in a subdirectory?
- What’s the best way to manage a lot of 301 redirects in WordPress?
- Shared hosting, multiple sites, can’t log in to WP due to .htaccess redirection
- Htaccess maintenance page rules that actually work with WordPress?
- What causes 404 errors that forces you to rebuild a .htaccess file?
- How to allow only vpn access to dashboard on Bitnami WordPress by IP address restricting
- How to set up MS Exchange Autodiscover alongside WordPress
- Xampp is not loading media
- PHP application in sub directory keeps redirecting to main site
- Blocking wp-login in HTACCESS has also blocked password protected pages
- htaccess redirect to path
- Non-wordpress subdomain on Multisite Installation
- Unable leverage Browser Caching on AWS Bitnami stack (Apache) through W3TC and Cloudfront CDN
- Downloading zip or tar.gz inside WordPress installation?
- Clicking PUBLISH Now Redirects to 404 PAGE NOT FOUND
- Rewrite rules and maintain URL
- Use htaccess to redirect wordpress non-existent page to homepage
- Subfolder renaming
- Targeting .htaccess file with file_put_contents
- Redirect Loop in Regex Moving to HTTPS
- .htaccess file changes disappear
- Need to edit htaccess while moving on WordPress
- WordPress login bug. Need an emergency solution
- How can I create a private site that is inaccessible from the outside?
- .htaccess and virtual host configuration for WP in its own directory
- 403 forbidden due to .htaccess?
- Issue after changing permalink structure [duplicate]
- Where is the htaccess in wordpress.com hosting?
- rewrite rule on plugin activation
- Debug errors for “Destination directory for file streaming does not exist or is not writable”
- Url redirection using htacess for my website
- Redirect loops in Bing holding my sites back
- Permalinks not working on debian with OVH