Apache redirect to another domain all URLs, except for ones starting with substring
Can anyone help me achieve a redirect in Apache from http://subdomain.example.com/ to http://example.com/ for all URLs, EXCEPT the ones starting with "files/"? Thank you
Put the code below in subdomain.example.com
virtual host section:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com [NC]
RewriteCond %{REQUEST_URI} !/files
RewriteRule ^(.*)$ http://example.com%{REQUEST_URI} [R=301,L]