I have a wordpress site with the wordpress files in a different folder (wpaw)
Wordpress url https://example.com/wapw
Site url https://example.com
I also have 3 or 4 subdomains, for example new.example.com
Currently the main domain and all the subdomains work correctly with the following RewriteRule
RewriteEngine On
RewriteRule %{REQUEST_URI} !^/wpaw/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wpaw/$1
RewriteRule ^(/)?$ /wpaw/index.php [L]
How can I modify the above so that http(s)://anysubdomain.example.com also redirects to https://example.com
Please write the below code in .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteEngine On
RewriteCond %{HTTP_HOST} ^anysubdomain\.example\.com [NC]
RewriteRule ^(.*) https:/.example.com/$1 [L,R=301]
</IfModule>
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.