Opencart https url principal - opencart

activate the security certificate in the store, it works well but is still the main url http and not https, and change the url in the config.php, when a product is entered if https appears or when the logo is clicked.
I can do?

Well, finally I did the following:
into de .httacces file write this
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
this is all.

Related

Redirect all but a few to new homepage with htaccess?

We have moved our site to a new domain and a new system. I am looking for a way to 301 redirect a bunch of urls to new custom urls on another domain, and send all the other pages to the homepage of the new domain. How can I achieve this?
I currently have the following in my .htaccess:
RewriteEngine on
RewriteRule ^(.*)$ http://newdomain.com/ [R=301,L]
I thought this would've redirected everything to the homepage, but oldomain.com/page would still send me to newdomain.com/page.
Any help or a nod to the direction would be highly appreciated!
You need to place all custom redirects before generic catch-all redirect in the end:
RewriteEngine on
RewriteRule ^page1/?$ http://newdomain.com/newPage1 [R=301,L,NC]
RewriteRule ^page2/?$ http://newdomain.com/newPage2 [R=301,L,NC]
RewriteRule ^page3/?$ http://newdomain.com/newPage3 [R=301,L,NC]
RewriteRule ^ http://newdomain.com/ [R=301,L]
Make sure you test this in a new browser to avoid browser caching issues.

htaccess subdomain redirect to port while keeping original url

I have trouble getting this to work properly, what I'm trying to do is make
http://subdomain.domain.com redirect to domain.com:8080 while keeping the original url
"subdomain.domain.com"
Code so far:
RewriteEngine on
RewriteCond %{HTTP_HOST} subdomain.domain.com
RewriteRule ^(.*)$ http://%1domain.com:8080$1 [L]
Which does the redirect, but browser url changes to "http://domain.com:8080" which is not what I seek.
Thank you in advance!
For this to happen you need to enable mod_proxy in subdomain\.domain\.com. Once it is enabled try this rule in DocumentRoot/.htaccess of subdomain.domain.com:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.(domain\.com)$
RewriteRule ^ http://%1:8080%{REQUEST_URI} [L,NE,P]

Switching from HTTP to HTTPS, lost all Facebook "Likes"

After switching to https://, all of our articles have lost their Facebook "Like" count. So I would like to disable https just for the Content area of our website, which is at /content.php (articles are in the form of content.php?212-My-Article)
My current .htaccess:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
What do I need to add, in order to redirect all content.php* traffic to http (non-secure), even if they type "https"
Thanks!
You can use this code:
RewriteEngine on
# uri is not /content.php
RewriteCond %{REQUEST_URI} !^/content\.php$ [NC]
# https is off
RewriteCond %{HTTPS} off
# redirec to https site
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
I found a way to fix this, without making content.php be unsecure. The Facebook "Like" HTML code looks like this:
<fb:like href="https://www.mysite.com/{vb:raw relpath}" font="tahoma" layout="standard" show_faces="false" width="260" action="like" colorscheme="light"></fb:like>
I use vBulletin. I changed it to http, and everything is fine now!
You'll need to make a change to your first rule to exclude content.php. The you simply add a rule for content.php that will do exactly the opposite of your other rule. You can add the [R=301] flag if your rules do what you expect them to do to turn them into permanent redirects. Permanent redirects are cached by the browser and will reduce the amount of requests done to your server. You don't need to use a capturing group for your first rule, and therefore I just used the ^ syntax, which matches every request.
RewriteEngine on
#Turn the entire site into https, except for content.php
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/content\.php$
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
#Use http instead for this url
RewriteCond %{HTTPS} on
RewriteCond ^content\.php$ http://%{HTTP_HOST}%{REQUEST_URI}
There is a very easy solution: with the og:url meta tag:
<meta property="og:url" content="http://example.com/old-url" />
You can read more about that into the FAQ section: https://developers.facebook.com/docs/plugins/faqs
The section is called: How do I move a page to a different URL?

.htaccess mod_rewrite regex for https server port

My website uses an external authentication service, which directs the user away from the desired page, performs the login, and then redirect back.
The trouble is when a user is redirected from an https page, the authentication service (which I cannot modify) stupidly redirects back to http:// with a :443 appended to the end of the URL, which just throws an error from Apache.
I already have an htaccess directive to ensure that the user is always viewing the current page on https:
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
What I'm looking for is a rewrite rule that will detect a URL starting with http, and ending in :443, and then have it redirect to https:// without the port being appended.
I had tried this:
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
But that doesn't appear to work.
Replace your .htaccess code with this code:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
This rule will redirect all http traffic to https irrespective of any port being used with http requests.

not able to redirect HTTP to HTTPS using rewrite in htaccess

I have tried url redirection of HTTP to HTTPS on my website by using several different solutions in .htaccess and none have worked.
Well, actually it does work if I type in directly:
(only for example) http://mywebsite.com
into the browser address bar....but if I try to redirect the url any other way, it won't work. If I try the link to my page listed on Google http://mywebsite.com/ it will not redirect to https://www.mywebsite.com. I need it to redirect from HTTP to HTTPS if someone clicks the link to my page from a search engine.
So far I have tried:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
then I tried...
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
and then I tried...
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R,L]
None worked. What else should I try? (this website is being hosted on a web hosting service site that has uses an apache web server). Also, I have an SSL certificate for the page, if that makes any difference.
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Tip: Clear your browser cache or use a different browser to test.