.htaccess redirect primary domain but not subfolder

I was wondering how to exclude a subfolder from a .htaccess redirect.

I have a .htaccess file in the root of my old domain, and I have the following in it:

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] 

This, of course, redirects any traffic from the old domain to the new one. But I want to exclude the directory from this rule. The value of www.olddomain.com/media/videos should not be redirected to www.newdomain.com/media/videos

The reason I want an exception is because I have static files such as videos on a shared web server (old domain) and I save everything that a site needs on a new VPS server (new domain).

+5
source share
1 answer

RewriteCond %{REQUEST_URI} !^/media/videos RewriteRule. , URL /media/videos, , RewriteRule .

+8

All Articles