Home .htaccess wildcard subdomain redirect with wildcard path 404 not found
Reply: 0

.htaccess wildcard subdomain redirect with wildcard path 404 not found

user879
1#
user879 Published in June 19, 2018, 6:23 pm

I'm trying to redirect wildcard subdomains with a wildcard path and it seems to be working, however when the url has any path a 404 error is returned.

For example https://test.mydomain.com/ will redirect with no issues to https://new.mydomain.com/ while https://test.mydomain.com/test will return a 404 error not found. I need https://test.mydomain.com/test to redirect to https://new.mydomain.com/test

My current .htaccess file is as follows

RewriteEngine on

RewriteCond %{HTTP_HOST} ^\*\.mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.\*\.mydomain\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ "https\:\/\/new\.mydomain\.com\/$1" [R=301,L]

Any help would be appreciated. Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.340354 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO