tags:

views:

13

answers:

1

Following problem, i want to route all requests from http to htts, after this route all requests wich cause an 404 to route.php script.

But i dont know, how to tell mod_rewrite to 1st use rule one, and than rule two?

My Rule looks like this:

RewriteEngine   on
RewriteCond     %{SERVER_PORT}   !^443$
RewriteRule     (.*)             https://%{HTTP_HOST}/_playground/$1

RewriteCond     %{SCRIPT_FILENAME} !-f
RewriteCond     %{SCRIPT_FILENAME} !-d
RewriteCond     %{SERVER_PORT}   !^443$
RewriteRule     (.*)             https://localhost/_playground/route.php?to=$1


enter code here
A: 

mod_rewrite follows the sequence of the rules:

The rewriting engine loops through the ruleset rule by rule (RewriteRule directives) and when a particular rule matches it optionally loops through existing corresponding conditions (RewriteCond directives)

ref here: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

and you can use flags to further tuning your rules: http://httpd.apache.org/docs/2.2/rewrite/rewrite_flags.html

Andy Lin