简体   繁体   中英

Exclude subdomain from redirecting to index.php

I'm trying to solve a mod_rewrite issue but I can't seem to wrap my head around it. I tried serval solutions from stackoverflow threads but it isn't working.

Basically I have a Wordpress Multisite installation that forwards subdomains to index.php I want to make and exception for subdomain test .simapro.com so it doesn't get redirected to index.php but has its normal behaviour. How do I do this?

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

Add a RewriteCond in your last rule:

RewriteCond %{HTTP_HOST} !=test.simapro.com
RewriteRule . index.php [L]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM