Mobile app version of vmapp.org
Login or Join
Samaraweera270

: Keep current .htaccess file but add subdomain handler Below is my current .htaccess file. I want to add a method by which I can conduct a simple pass-through if someone hits my subdomain. My

@Samaraweera270

Posted in: #Htaccess #Subdomain #Wordpress

Below is my current .htaccess file. I want to add a method by which I can conduct a simple pass-through if someone hits my subdomain. My current .htaccess is designed to grab any one who comes to my site and force them to the SSL version.

I now need to allow someone to come to my site and hit a subdomain mysite2.mysupercoolserverhere.com without being passed to SSL or generally bothered by any of my WordPress-centric .htaccess stuff.

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ mysupercoolserverhere.com/ [R,L]

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

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ [L]
RewriteRule . index.php [L]


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


I attempted to add:

RewriteRule ^(mysite2.*/)$ - [PT]


But this did not work. Can someone please tell me how to fix/add my Rewrite Rule so that I can let users hit my subdomain without being forced to my TLD?

I need to fix my .htaccess file so my WordPress site continues to work as intended but allow users to surf over to my subdomain without being affected by my current .htaccess file.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera270

1 Comments

Sorted by latest first Latest Oldest Best

 

@Samaraweera270

I added a new rewrite condition:

RewriteCond %{HTTP_HOST} ^www.domain.com$


At the very top of my .htaccess file. By adding the condition that all the below only works with my TLD I no longer have issues with it grabbing my subdomains.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme