301 redirect

I want to redirect 403 to another domain.

IE: I have a program on another domain that has links to our site. The links are local for example:

about.php is on siteB but is not on siteA. I don't want to put full paths of the links in because when I update my navigation file I copy it from the other site to this one. I would rather htaccess do this:

if about.php does not exist 301 redirect to http://www.siteb.com/about.php

and do on. However, I do not want it to redirect on existing files for example index.php should not redirect.
Robert SaylorSenior DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(about).php$ http://www.siteb/$1.php [R=301,NC,L]

Open in new window

Robert SaylorSenior DeveloperAuthor Commented:
Anyway to not have to write out the filenames?

RewriteRule ^/?(*).php$ http://www.siteb/$1.php [R=301,NC,L]

Can I use a wildcard then exclude files that exists?
RewriteRule ^/?(.+)\.php$ http://www.siteb/$1.php [R=301,NC,L]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert SaylorSenior DeveloperAuthor Commented:
THANK YOU saved me a bunch of time!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.