How to wildcard redirect all http to https

hi,

I’ve tried to days now to make a wildcard redirection from all http to https
this is what i got now:

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R=301,L]

At a glance, it seems OK. Maybe you forgot to enable the rewrite engine?

RewriteEngine On

nopw i didnt forget it… is there someway that someone could help me specifically on this one and could contact me - Am I allowed to write my website name here in this forum?

A link to your site wouldn’t really help much.
What would help a lot is seeing what your htaccess file looks like.

this is all my htaccess:

STARTCOMPRESSNITRO

RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.css$ assets/style.php?l=4&p=$1 [NC,L]

RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(\/?((catalog)|(assets)).+)\.js$ assets/script.php?l=4&p=$1 [NC,L]

 ENDCOMPRESSNITRO
 BEGIN OpenCart
 1. To use URL Alias you need to be running apache with mod_rewrite enabled.
 2. In your OpenCart directory rename htaccess.txt to .htaccess.
 For any support issues please visit: http://www.opencart.com

 Rabbit Rabbit Security Upgrade
Options +SymLinksIfOwnerMatch

 Prevent Directory listing
Options -Indexes

 Prevent Direct Access to files
<FilesMatch "\.(tpl|ini|log)">
 Order deny,allow
 Deny from all
</FilesMatch>

 SEO URL Settings
RewriteEngine On
RewriteBase /

 If using subdirectory, update RewriteBase /
 Store URL: yourstore.com/shop
 Update to: RewriteBase /shop/

RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* – [F,L]

 Additional Settings that may need to be enabled for some servers 
 Uncomment the commands by removing the # sign in front of it.
 If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
 php_flag register_globals off

 2. If your cart has magic quotes enabled, This may work to disable it:
 php_flag magic_quotes_gpc Off

 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
 php_value upload_max_filesize 999M

 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
 php_value post_max_size 999M

 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
 php_value max_execution_time 200

 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
 php_value max_input_time 200

 7. disable open_basedir limitations
 php_admin_value open_basedir none
 END OpenCart

 BEGIN Rabbit Rabbit
 Enable Gzip Compression
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

 Remove Browser Bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

 Leverage Browser Caching
<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType image/jpg "access plus 1 week"
 ExpiresByType image/jpeg "access plus 1 week"
 ExpiresByType image/gif "access plus 1 week"
 ExpiresByType image/png "access plus 1 week"
 ExpiresByType text/css "access plus 1 week"
 ExpiresByType application/pdf "access plus 1 week"
 ExpiresByType text/x-javascript "access plus 1 week"
 ExpiresByType application/x-shockwave-flash "access plus 1 week"
 ExpiresByType image/x-icon "access plus 1 week"
 ExpiresDefault "access plus 1 week"
</ifModule>
 END Rabbit Rabbit

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R=301,L]
 STARTNITRO
ExpiresActive On

CSS JS XML TXT - 1 WEEK
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, public"
ExpiresDefault "access plus 1 week"
SetOutputFilter DEFLATE
</FilesMatch>

JPG JPEG PNG GIF SWF - 1 MONTH
<FilesMatch "\.(jpg|jpeg|png|gif|swf|JPG|JPEG|PNG|GIF|SWF)$">
Header set Cache-Control "max-age=2682000, public"
Header set Last-Modified "Wed, 05 Jun 2009 06:40:46 GMT"
ExpiresDefault "access plus 1 month"
SetOutputFilter DEFLATE
</FilesMatch>

OTF ICO PDF FLV - 1 MONTH
<FilesMatch "\.(otf|ico|pdf|flv)$">
Header set Cache-Control "max-age=2682000, public"
ExpiresDefault "access plus 1 month"
SetOutputFilter DEFLATE
</FilesMatch>

HTML HTM PHP
<FilesMatch "\.(html|htm|php)$">
SetOutputFilter DEFLATE
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
</FilesMatch>
 ENDNITRO

This may seem like the dumb question but do you have a valid security certificate installed on the site?

@oddz,

Finally, a good question! If you don’t have a secure server, nothing can help you (you’d be redirecting into a black hole).

Up top, too, your initial code was good albeit I would have checked for

[code]RewriteCond %{HTTPS} !^on$

OR

RewriteCond %{SERVER_PORT} !^443$[/code]

For routine code like this, have a look at the examples at http://dk.co.nz/seo.

Regards,

DK

On a side note, if yours is a BIG site, I would suggest redirect slowly i.e. one folder/section at a time. Google may deindex your entire site and may take sometime to re-index it.