troubleshooting Question

htaccess - redirecting if no match

Avatar of Chris Andrews
Chris AndrewsFlag for United States of America asked on
Apache Web Server
3 Comments1 Solution258 ViewsLast Modified:
Ok, currently in my .htaccess file I have:

RewriteEngine on
RewriteRule ^([0-9]+)$ index.php?p=$1 [L]

It's designed so that if something like this comes in:

it will take that number, assign it to $p, and then run it through index.php so I can process it.

That works great and I need to keep that process.

Now.... what I would like to do is have any url that does not match that format ( to be forwarded to another domain intact (maintaining its directory structure).

So that:  is redirected to

and  is redirected to

and so on... but only if it does not match the type format.

Is that possible?

Thanks, Chris
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros