apache - .htaccess conditional RewriteBase -
the following part of .htaccess:
<ifmodule mod_rewrite.c> rewritecond %{https} =on #rewriterule .* http://%{server_name}%{request_uri} [r,l] rewriteengine on #rewritebase /~example/ rewriterule ^$ webroot/ [l] rewriterule (.*) webroot/$1 [l] </ifmodule>
when remove comment before rewritebase, able access website via shared ssl offered webhost: https://secure.myhost/~example/
. however, causes server error when tried access non secure via http://example.com
my question about: there way make .htaccess consider rewritebase conditionally based on https or http ?
your rewrite rules need refactoring thing. replace code this:
options +followsymlinks -multiviews <ifmodule mod_rewrite.c> rewriteengine on rewritebase /~example/ rewritecond %{https} on rewriterule ^ http://%{http_host}%{request_uri} [r,l] rewriterule (?!webroot/)^(.*)$ webroot/$1 [l,nc] </ifmodule>
I am visiting https://sharecodewiki.blogspot.com/2014/09/apache-htaccess-conditional-rewritebase.html# and the page is full of ads. Reporting it in case you were hacked.
ReplyDelete