So I've been fiddling with .htaccess and I was able to remove both removing a subdirectory and having a non-www subdirection. Please find code below:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*) http://domain.com/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !(.*)subdir
RewriteRule ^(.*)$ subdir/$1 [L]
This can redirect:
www.domain.com/subdir/file
or
www.domain.com/file
to
domain.com/file
However, it can't redirect
domain.com/subdir/file
to
domain.com/file
That's my only problem with this code. Could somebody enlighten me what am I doing wrong? Any help is much appreciated. :)
You can use an
OR
condition in conditions: