.htaccess - How to redirect from non-www to www in joomla site whith ssl -


i have joomla 2.5 & virtuemart 2 eshop.

in www.mysite.com works perfect ! site redirect http https in checkout area , in other areas of site (with plug-in ssl redirection).

the problem if insert in site http:/mysite.com in checkout redirect https://mysite.com/checkout , browser block page (error: ssl_error_bad_cert_domain) , certificate www.mysite.com !!

how can fix problem. if use .htaccess

rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,l] 

i thin have problem in ssl area beacause in rewriterume have http:// ?

the .htaccess inside have

## # @package      joomla # @copyright    copyright (c) 2005 - 2014 open source matters. rights reserved. # @license      gnu general public license version 2 or later; see license.txt ##  ## # read if choose use file! # # line below section: 'options +followsymlinks' may cause problems # server configurations.  required use of mod_rewrite, may # set server administrator in way dissallows changing in # .htaccess file.  if using causes server error out, comment out (add # # beginning of line), reload site in browser , test sef url's.  if work, # has been set server administrator , not need set here. ##  ## can commented out if causes errors, see notes above. options +followsymlinks  ## mod_rewrite in use.  rewriteengine on  ## begin - rewrite rules block out common exploits. # if experience problems on site block out operations listed below # attempts block common type of exploit `attempts` joomla! # # block out script trying base64_encode data within url. rewritecond %{query_string} base64_encode[^(]*\([^)]*\) [or] # block out script includes <script> tag in url. rewritecond %{query_string} (<|%3c)([^s]*s)+cript.*(>|%3e) [nc,or] # block out script trying set php globals variable via url. rewritecond %{query_string} globals(=|\[|\%[0-9a-z]{0,2}) [or] # block out script trying modify _request variable via url. rewritecond %{query_string} _request(=|\[|\%[0-9a-z]{0,2}) # return 403 forbidden header , show content of root homepage rewriterule .* index.php [f] # ## end - rewrite rules block out common exploits.  ## begin - custom redirects # # if need redirect pages, or set canonical non-www # www redirect (or vice versa), place code here. ensure # redirects use correct rewriterule syntax , [r=301,l] flags. # ## end - custom redirects  ## # uncomment following line if webserver's url # not directly related physical file paths. # update joomla! directory (just / root). ##  # rewritebase /  ## begin - joomla! core sef section. # rewriterule .* - [e=http_authorization:%{http:authorization}] # # if requested path , file not /index.php , request # has not been internally rewritten index.php script rewritecond %{request_uri} !^/index\.php # , request within component folder, # or site root, or extensionless url, or # requested url ends 1 of listed extensions rewritecond %{request_uri} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [nc] # , requested path , file doesn't directly match physical file rewritecond %{request_filename} !-f # , requested path , file doesn't directly match physical folder rewritecond %{request_filename} !-d # internally rewrite request index.php script rewriterule .* index.php [l] # ## end - joomla! core sef section. 

try add lines in .htaccess:

rewritecond %{https_host} ^mysite\.com$ [nc] rewriterule ^(.*)$ https://www.mysite.com/$1 [r=301,l] 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -