php - How to force SSL on a specific file example.org/index.html? -
i have php based website....i trying use ssl...the ssl working fine in site, problem not redirect https....it show http , try edit in .htaccess file, not working.... site open format example.org/index.html /index.html
i trying use this, not working
rewritecond %{https} off rewriterule ^ https://%{http_host}%{request_uri} [ne,l,r=301]
.htaccess code:
rewriteengine on rewritebase / #authuserfile /home/products/html/path/.htpasswd #authgroupfile /dev/null #authname "private area" #authtype basic #<limit post> #require valid-user #</limit> <filesmatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> fileetag none <ifmodule mod_headers.c> header unset etag header set cache-control "max-age=31536000, public" </ifmodule> </filesmatch> options -indexes rewritecond %{request_filename} !-f rewriterule ^(.+).html$ $1/?%{query_string} -------urls--------- rewriterule ^index/$ path/index.php rewriterule ^index/([^\/]+)/$ path/index.php?list=$1&%{query_string}
you can use php redirect.
i use function check if request https or not:
function ishttps() { return (isset($_server['https']) && $_server['https'] === 'on') || $_server['server_port'] === 443; }
and check if request not https, , redirect:
if (!ishttps()) { header("location: https://www.example/index.php"); }
Comments
Post a Comment