The reason why the HTaccess file is not working for you is because you're running a server on Nginx instead of Apache's .htaccess your server uses a "nginx config" this is why .htaccess will not work properly. this will also show you why you're still running a 302 redirect instead of a 301 redirect
http://www.redant.com.au/ruby-on-rails-devops/manage-ssl-redirection-in-nginx-using-maps-and-save-the-universe/
https://www.digitalocean.com/community/questions/http-https-redirect-positive-ssl-on-nginx
for referencing these URLs below will tell you everything you need to know about your configuration and how to set it up. I've placed a lot of redirects below because there are so many different ways of doing this below the two URLs where it says I recommend using this is the configuration that should be default on your server in order to force SSL
http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name
** I recommend using this to fix use this on your nginx config file**
_**`server {
listen 80;
server_name www.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name www.domain.com;
[....]
}`**_
might be easier this way
<code>server {
listen 80;
server_name my.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name my.domain.com;
[....]
}</code>
you are still putting out 302's I double checked your server
http://www.feedthebot.com/tools/headers/test.php
https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
HTTP/1.1 **302 Found **
Server: nginx/1.6.0
Date: Sat, 11 Apr 2015 02:59:23 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: https://www.directtraveller.com/awards
Header transfer size: 199
http://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
301 Moved Permanently
| Status: | 301 Moved Permanently |
| Code: | 301 |
| Server: | nginx/1.6.0 |
| Date: | Sat, 11 Apr 2015 02:12:51 GMT |
| Content-Type: | text/html; charset=iso-8859-1 |
| Content-Length: | 370 |
| Connection: | close |
| Location: | https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp |
https://www.directtraveller.com/holidays/about-direct-traveller/british-travel-awards.asp
302 Found
| Status: | 302 Found |
| Code: | 302 |
| Server: | nginx/1.6.0 |
| Date: | Sat, 11 Apr 2015 02:12:51 GMT |
| Content-Type: | text/html; charset=iso-8859-1 |
| Content-Length: | 296 |
| Connection: | close |
| Location: | https://www.directtraveller.com/awards
|
| Status: | 200 OK |
| Code: | 200 |
| Server: | nginx/1.6.0 |
| Date: | Sat, 11 Apr 2015 02:12:52 GMT |
| Content-Type: | text/html |
you can convert Htaccess to nginx using this tool http://winginx.com/en/htaccess
however I would force SSL instead of use a rewrite through the converter. The redirects below work but I would use the server-side redirect labeled use this
Check out Engine Yard for more redirects I have placed quite a few here
https://blog.engineyard.com/2011/useful-rewrites-for-nginx
this is a basic redirect you can put the port or each port in place.
server {
server_name example.com;
rewrite ^/(.*) https://example.com/$1 permanent;
}
USE THIS
Redirect both, non-SSL and SSL to their www counterpart:
<code>**server {
listen 80;
listen 443 ssl;
server_name directtraveller.com;
return 301 $scheme://www.directtraveller.com$request_uri;
}**
server {
listen 80;
listen 443 ssl;
server_name example.com;
# rest goes here...
}</code>
Add a www with this block
server {
listen 80;
listen 443 ssl;
server_name directtraveller.com;
rewrite ^(.*)$ $scheme://www.directtraveller.com$1;
}
(
)
Remove a www with this block instead
server {
listen 80;
server_name www.directtraveller.com;
rewrite ^(.*)$ $scheme://directtraveller.com$1;
}
<code>rewrite ^(.*)$ https://$host$1 permanent; #3
rewrite ^ https://$host$request_uri permanent; #4
I**f you have any questions please feel free to ask I hope this is enough information and not overwhelming. If you feel overwhelmed simply use the very first config.**
**Sincerely,**
**Tom**</code>