regex - HTTPS redirect for directory doesn't work correctly -
my goal forcefulness https on admin
directory of site. however, using usual way give unusual result. here content of .htaccess
:
rewriteengine on rewritecond %{server_port} 80 rewritecond %{request_uri} admin rewriterule ^(.*)$ https://www.domain.com/admin/$1 [r,l]
however, when seek open http://www.domain.com/admin/home.php
, instead of redirecting https://www.domain.com/admin/home.php
sends me https://www.domain.com/admin/admin/home.php
.
so sort of creates admin/
part of url twice.
i tried changing lastly line of .htaccess
rewriterule ^(.*)$ https://www.domain.com/$1 [r,l]
(which doesn't create sense me, tried still) , redirected same wrong url, confused me further.
i'm not sure if should matter, i've tried replacing [r,l]
[l,r=301]
suggested elsewhere on so, no avail.
why happening , what's solution?
it due /admin/
in target url. alter rule this:
rewriteengine on rewritecond %{server_port} 80 rewriterule ^admin(/.*)?$ https://www.domain.com%{request_uri} [r,l,nc]
regex apache .htaccess mod-rewrite redirect
No comments:
Post a Comment