I am running into problems with my root .htaccess file is hijacking the .htaccess file in my subdomain. I have tried to exclude my subdomain only to run into a blank screen. I have tried with Rewrite off in my subdomain. But with both needing different rules to function I am looking for a way to get around the root inheritance structure, so the my .htaccess file in my subdomain will work. Over the last 14 days I have tried over 6 different to get both .htaccess files to work so I am hoping someone in the forum have a answer so I can get some sleep! People are starting to ask me if I am in the cast of The Walk Dead! #Exclude subdomain folder RewriteEngine On RewriteRule ^(sub)($|/) - [L] or RewriteEngine On RewriteCond %{REQUEST_URI} !^/sub/.*$ RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 or RewriteEngine on RewriteRule ^sub($|/) - [L] or RewriteEngine on RewriteCond %{HTTP_HOST} ^mainsite\.com RewriteCond %{HTTP_HOST} !^sub\.mainsite\.com$ RewriteRule (.*) http://www.mainsite.com/$1 [R=301,L] or RewriteEngine on RewriteCond %{HTTP_HOST} ^sub\.mainsite\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.sub\.mainsite\.com$ RewriteRule ^/?$ "\-" [R=301,L] or <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on # If requested URI does not end in "/" RewriteCond $1 !/$ # add a trailing slash RewriteRule ^(.+)$ /$1/ [R=301,L] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^([^.]+)\.mainsite\.com80)?$ RewriteCond %{DOCUMENT_ROOT}/sub/%1/%{REQUEST_URI} -d [OR] RewriteCond %{DOCUMENT_ROOT}/sub/%1/%{REQUEST_URI} -f RewriteRule (.*) /sub/%1/$1 [L]
There is a simple fix for this, create a .htaccess file in the directory you would like to exclude with only: RewriteEngine Off Unless you want to have rules in the subdirectory, in that case, just fill in the rules and they will null the ones in the root directory.
Tried turning RewriteEngine Off, and working with the rewrite rules that came with my software htaccess file but it didn't work. Kept running into a blank screen or file didn't exist error. I know there as to be way to get around the htaccess files when it come to sudomain? I was given this and its the second time. But I couldn't get it to work, plus it requires you to add a prefix "sd" to my sub-domain; please review I am not sure if this would work either RewriteEngine On Options -MultiViews RewriteCond $1!/$ RewriteCond $1!\. RewriteRule ^(.+)$ /$1/ [R=301,L] RewriteCond %{REQUEST_URI}!^/sd_ RewriteCond %{HTTP_HOST}!^www\.domain\.com [NC] RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com RewriteRule (.*) /sd_%1/$1 [L]
So you created a second .htaccess file in the directory that is assigned to your subdomain? We have faced this issue with numerous customers utilizing the Apache webserver, seemingly we have not had this issue since all of our servers were upgraded to use LiteSpeed. The resoultion every time was to create a second .htaccess in the directory that is assigned to the subdomain and in that file disable rewrite engine.