You’re close.
I added a few more places to capture more scenarios and used the HTTP_HOST variable in the rule. The $1 is not needed in the condition as that would match what’s captured in the above condition.
<IfModule mod_rewrite.c>
RewriteEngine On
Rewritecond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteCond %{REQUEST_URI} ^/subsite/? [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
</IfModule>
I recommend Made With Love’s .htaccess check to verify your testing.
Related Posts:
- Working with Reverse Proxies and Multisite Installation
- External rewrite rules missing in htaccess – Multisite
- Moving a WP Multisite to a subdirectory
- WordPress Multisite – Multiple subfolders for blogs
- WordPress multisite subdirectory redirect infinite loop issue
- multisite htaccess 301 redirects
- W3 Total Cache Plugin with WP 3 MultiUser [closed]
- Domain redirect in WordPress multisite
- Suppress subdirectory from WordPress Multisite primary URL
- Why wordpress multisite redirect to wp-signup if site exists?
- Sub-subdomain getting redirected to main domain
- How to exclude a directory from WordPress permalinks in a Multisite environment?
- Redirect subdomain homepage to domain specific page in wordpress multisite
- WordPress multisite subdirectory on nginx behind reverse proxy
- Multisite Redirect issue
- How to disable the default WordPress redirect to non-www URLs?
- Redirect subdomain in Multisite installation?
- Issue with htaccess redirection in WP Multisite
- Why my deleted url is redirecting to random post?
- Redirect only posts to New Domain
- Temp URL Redirect Loop
- Wrong Redirect/Rewrite Rules?
- Htaccess file isn’t redirecting http sub-pages to https––they display 404 error instead, tried many solutions and none work
- URL without www redirect directly with submission page – Multiwordpress install
- Multisite Redirection to new domains
- Multisite Subdirectory with same domain subdomain
- Redirect old uploads after moving to multisite
- WordPress: how to change URL for individual MultiSites?
- How to host unrelated pages on WordPress domain
- Multisite Subdomain Redirect Mask
- Cannot use Network Admin (Dashboard) on Multi-site after 301 www redirect
- 301 Redirection After Comment
- Redirect Function Prevents Images from Showing in Front-end Media Uploader
- multisite 404 subfolder same name slug as site
- How to make the redirects right? IP to domain name folders
- WordPress Multisite redirect loop
- Multisite, different domains, optional subdirectory, and htaccess
- WP Multisite .htaccess interferes with cgi-bin
- Redirect extra url to Multisite in folder
- How can I set up a completely separate (not multisite) WordPress installation as a subdirectory of an existing WordPress blog?
- Site Redirecting to wp-signup.php
- multisite 404 error for subdirectory
- Multisite htaccess on localhost with WP as an SVN external?
- Non-WordPress page in subdirectory under WordPress page
- Multisite: differences between subdomain and subdirectory mode? Can it be switch after installation?
- NGinx + WordPress Subdomain Multi with core in Subdirectory
- Multisite 404 errors and non-www redirecting to home page
- Error 101 after upgrading WordPress
- Redirect all users, except network administrators, from the main site to a subsite
- Multisite non-www domain redirects to sign-up
- Multisite non www domain gives registration error but should redirect to www.domain.com
- 301 Redirects for posts, category, pages from original domain to sub-domain of multisite
- WordPress multisite htaccess
- Change multi-site installation from sub-domains to sub-directories
- Installing multisite on domain with existing subdirectory wordpress installations
- Redirect users on logout
- wp_redirect not working on admin menu page
- How to redirect subcategories to a page?
- Create rewriterules for different domains in htaccess file with WP multisite
- Auto Redirect after login
- Site kit Google Analytics setup giving Error: {“error”:”invalid ‘redirect_uri'”}
- All pages have 302 redirect, which I can’t remove
- Multsite redirecting to the main site
- Add additional non-rewrite .htaccess directives on multisites via mod_rewrite_rules filter
- Error uploading files bigger than 58 MB
- WordPress Multi-Site on Ubuntu 18.04 LAMP Keeps Re-Directing
- Some PDF files get Forbidden Access and other open normally on the same directory subsites
- 301’s not working with multisite
- WordPress sub-domain multisite 505 error
- Multisite, Subdomain, shared NFS directory Linux HELP
- ReDirect subfolder link to another sub-folder and force SSL
- How to protect specific uploaded files from being accessed by non-logged-in users in WP-multisite
- Multisite install w/ Sub domains on a subdomain
- 404 redirecting to home [closed]
- Multisite installation on an existing single installation
- why there is a large file named core in wpmu’s directory?
- MULTISITE SUB-DOMAIN JUST SHOWS INDEX OF -> CGI-BIN INSTEAD OF SHOWING SITE
- Multisite Sub domains not working
- Multisite Subdirectory Site Dashboard redirect loop
- How to organize my js files
- How do I correctly configure my AMPPS localhost to use subdomains for multisite?
- Update WP install to WP network & it broke the DB connection
- Infamous admin login redirect
- How to Force WWW. in Domain With WordPress MU Domain Mapping Plugin?
- Two installs conflicting – Pages redirecting
- Date based redirects of posts that no longer exist
- Open wordpress page in directory the way index.html would open
- Using WordPress multisite for subsites only
- Redirect after login when WordPress in subdirectory
- using htaccess to check for cookie on permalink then conditionall rewrite with query parameter
- Using multisite, how can I get two different sites on the network to have different active themes?
- Nginx rules for subdomain multisite install (Bedrock)
- Multisite installation without using domain root
- How to put a Custom Folder under one sub-site of Multisite WP?
- Redirect WordPress MS to no-www version, excepting some dirs and prefixes
- How do I combine wp_redirect and add_filter?
- Multisite redirect loop for a single www domain
- Is it possible to install a different wordpress installation in a subdirectory? [duplicate]
- Multisite subdirectory blogs missing slash
- Nice font not working when http to https – SSL Issue