I want to use .htaccess on an Apache server to redirect only calls to the server that are not files or folders in the filesystem. For example, if the server gets a request for:
http://www.domain.tld/page1.html
And page1.html is not an actual file on the server, it should 301 redirect to:
http://new.domain.tld/page1.html
Otherwise, it should not do anything. Is this possible? If so, how? Please provide some example code if possible. The code I currently have is:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.domain\.tld [NC]
Rewriterule ^(.*)$ http://subdomain.newdomain.tld/$1 [L,R=301]
While this does the redirect, it doesn't ignore actual files and folders on the server.