Nadine
Nadine

Reputation: 787

.htaccess redirect. Ignore other rules once match found?

I have a massively bespoke .htaccess file which I cannot modify too heavily (as it will break an existing legacy site). However, I need to redirect some paths.

I have placed the following near the top after RewriteEngine on:

Redirect 301 /old_very_long_page /foob/new_site/newpage

The redirect works, but another rule in the .htaccess appends the title to the page as a query string like:

http://foob/new_site/newpage?foo=blablalblalbabla

I cannot remove this rewrite because it will break other parts of the site. Is there a way that I can place a return in a .htaccess to ignore all other rules once a match is found?

Upvotes: 0

Views: 619

Answers (1)

Nadine
Nadine

Reputation: 787

I've figured it out. I'll answer my own question in case anyone else comes across the same problem.

RewriteRule ^old_very_long_page(/?.*) /foob/new_site/newpage$1 [R=301,L]

Upvotes: 1

Related Questions