Chris Muench
Chris Muench

Reputation: 18338

.htaccess rewrite rule explained (simple)

  RewriteCond %{SERVER_PORT} !^443$
  RewriteRule MATCHME https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

IF MATCHME is not in the URL then will the RewriteRule NOT Be processed? Could you link me to some documentation?

Upvotes: 3

Views: 1821

Answers (1)

Michael Berkowski
Michael Berkowski

Reputation: 270757

That is correct. If the pattern MATCHME is not present, no rewriting will take place.

If you require a catch-all rule to be matched when your RewriteCond is active, you can specify an additional rule like:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule MATCHME https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
# Catch-all rule
RewriteRule ^(.*)$ https://%{SERVER_NAME}/someotherpage [L,R,QSA]

Review the mod_rewrite documentation.

Upvotes: 2

Related Questions