user1095332
user1095332

Reputation: 433

htaccess: redirect if not match

I want to forward everything on site X (http://example.com) to Site Y (http://destinationwebsite.com) except "PAGEX.aspx"

(http://example.com/PAGEX.aspx?callback=7259%2F7062434327_9fbc6da0cd)

Upvotes: 3

Views: 8400

Answers (2)

Ωmega
Ωmega

Reputation: 43673

This should work:

 RewriteCond %{REQUEST_URI} !^/?PAGEX.aspx$
 RewriteRule .* http://destinationwebsite.com [R=301,L]

Upvotes: 3

Joey
Joey

Reputation: 354516

If you prepend ! to your regex in the RewriteRule it will act as a negation.

Upvotes: 2

Related Questions