i have just installed my SSL wich i have bought on transip.nl
When i take a look at the website which i have installed for it looks like its not going well.
i have checked : https://www.sslshopper.com/ssl-checker.html#hostname=sloffenenpantoffels.nl
Looks fine but its not. there is no safe logo and he is still telling its an unscure connection.
When i check the URL its HTTP and not HTTPS.
Webshops is build in a magento multistore.
I have made own domain and selected his own IP for the SSL. I pointed the root folder to the folder from the main domain of the multistore.
In my htaccess file there is a rule:
RewriteCond %{HTTP_HOST} ^(.*)sloffenenpantoffels.nl
RewriteRule ^ - [E=MAGE_RUN_CODE:ditwiljehebben]
I hope that anyone can help me out here.
To force SSL just use the following:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
Related
I have the following domain that does not work without the www.
wwww.mydomain.com works
mydomain.com = does not work
The root htaccess file (primary domain is something else) automatically seemed to have this code in it.
# php -- END cPanel-generated handler, do not edit
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^/?$ "https\:\/\/www\.mydomain\.io\/mydomain" [R=301,L]
I added this code in the website's own htaccess file.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
What am I doing wrong?
Currently mydomain.com goes to something quite strange (it duplicates the domain name): and has an error
https://www.example.com/example.com/
Error on page
Not Found
The requested URL was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Can I delete the code which says "do not edit". Which one is working and why/how? A fix with an explanation would be appreciated.
The issue was basically resolved by:
Adding the rewrite engine rules:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Deleting the forwarding in the DNS management console and ONLY leaving in the forwarding in the addondomains section. So, in the cpanel - addon domains, create forwarding and delete the forwarding in the DNS section. This was the key part.
There was an additional folder outside of the public_html for this domain and that was deleted as well.
Finally, adding these rules to force https was useful:
https://www.hostinger.co.uk/tutorials/ssl/forcing-https
Also noting the helpful comment: "Which web server are you using? Look through your web server configuration files. Your problem is that you have a redirect from HTTP to HTTPS and the path URL is configured wrong."
I have a problem with our site after reinstalling the SSL certificate, where the www version of the site (www.mountainx.com) pulls up a completely different site. if you enter the non-www version (mountainx.com), it goes to the correct website. Some of the rules in my .HTAccess file are here - Any help would be appreciated or at least I would like to get a discussion going -
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
Also I have a certain number of proxy redirects that are not working either after the SSL change and I had to redirect them to the original hosts. To clarify, we use a third party to host our calendar but want to obscure the URL so it looks like we are still hosting the files. When the SSL certificate was installed, it suddenly started throwing up a 503 error so we agreed to change to the original URL hosted remotely. Also any good tutorials on .htaccess file out there? They seem to be pretty few and far between.
I've got a site (example.com) and a blog (externalblog.com) which is hosted externally and reverse-proxied using ISAPI rewrite. So if you go to www.example.com/blog you're actually on externalblog.com, but the URL is masked.
I've got this working with a number of sites, but the issue is when the parent site uses HTTPS, whereas the blog is only HTTP. When visitors attempt to follow old links, the blog posts will show normally under the https version of the url, but the stylesheets are all broken and a "no certificate" warning is shown.
I need an htaccess rule that will do 2 things:
Forward anyone attempting to access an https version of a blog post only (ie anything within www.example.com/blog) to the http version instead.
Forward anyone attempting to visit example.com/blog (without the www) to http://www.example.com/blog instead of the https version, which it currently does.
However I've like the rules to only affect www.example.com/blog and nothing else on example.com. My current rule for ISAPI rewrite on example.com is as follows:
RewriteRule ^blog(.+)$ http://www.externalblog.com$1 [R=301,L]
This works correctly and is based on an article online called "using reverse proxying to pull a wordpress blog into your domain" – I can't add any more links here due to not having enough reputation.
Any help would be much appreciated.
EDIT: I tried the following
RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} ^[A-Z]+\s/blog [NC]
RewriteRule ^blog(.+)$ http://www.externalblog.com$1 [R=301,L]
This works as far as rewriting https to http – but reverse proxy URL masking no longer kicks in.
Your explanation is rather unclear, so sorry if my answer will be unrelated. I suppose you are trying to force everything under www.example.com/blog to be HTTPS, instead of HTTP? Then try this rule:
RewriteEngine On
# HTTP to HTTPS redirect rule
RewriteCond %{HTTPS} off [NC]
RewriteCond %{HTTP:Host} ^www\.example\.com$ [NC]
RewriteRule ^(blog/.*)$ https://www.example.com/$1 [NC, R=301, L]
# No www. to www. redirect rule
RewriteCond %{HTTP:Host} ^example\.com$ [NC]
RewriteRule ^(blog/.*)$ https://www.example.com/$1 [NC, R=301, L]
# Your proxy rule goes here, I suppose it looks like:
RewriteRule ^blog(/.*)$ http://www.externalblog.com$1 [NC, P]
I want my site to act like this. If user inputs site.cz it should be redirected to site.eu/?lang=cs but the user should still see site.cz. Right now I have the following htaccess file:
RewriteCond %{HTTP_HOST} site\.cz [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ http://site.eu/?lang=cs [L,R=301]
which works great and redirects only .cz request (dont do anything with .eu requests) but it displays .eu/?lang=cs in final. Problem is that I dont only want to display site.cz all the time but also links like site.eu/folder1/file1/?lang=cs should be redirected to site.cz/folder1/file1/
Any ideas how to accomplish this?
Thanks in forward
Are you using XAMPP or a web host? Upon testing, URL rewriting isn't working in XAMPP.. Anyway, you can try to check this, just make sure that your two sites are hosted by the same web hosting account:
RewriteCond %{HTTP_HOST} site\.cz [NC]
RewriteRule ^(.*)$ http://site.eu/$1?lang=cs [P,L]
But it looks like your sites aren't hosted by the same hosting account as what you've said:
when I use [P] flag I get an error "Following URL was not found on this server" – horin
I am trying to force HTTPS on a domain. It must be done using a method that works by domain name and not port number (due to host structure/setup).
My closest attempt was:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com$
RewriteRule ^.*$ https://www.mydomain.com/$1 [R=301,L]
This works when typing "mydomain.com" into the address bar, automatically redirecting to "https://mydomain.com" but when I type "www.mydomain.com" it does not work. I assume it is a syntax issue as I am very new to htaccess and have spent about 4 hours trying to create a solution from other's code.
Any chance of a pointer?
To make the setup a little more understandable.
/public_html/ - All files in this folder relate to www.mydomain.com
/public_html/subfolder - These folders contain files also relating to mydomain.com
/public_html/subdomain - These folders contain files relating to www.myotherdomain.com
My other domains are subdomains of mydomain.com for to be listed in the cpanel on the host. For example: subdomain.mydomain.com is the same as www.myotherdomain.com.
Hopefully that clears up the structure.
Your redirect happens whenever a request is made to the exact domain mydomain.com (that's what the RewriteCond is testing for). It doesn't apply to any other domains and doesn't detect HTTPS. Use this instead:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=301,L]