September 26, 201213 yr Hi there people first postI want all domain address to redirect to https://www.stiffnights.co.uk So if a user types in the browsers address bar like the following below :- http://stiffnights.co.uk https://stiffnights.co.uk www.stiffnights.co.uk stiffnights.co.uk http://www.stiffnights.co.uk It should transfer all the above in BLUE to https:\\www.stiffnights.co.uk Is that possible would I have to edit the .htaccess file please help. Thanks
September 26, 201213 yr is this any use to you RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com RewriteRule (.*) http://www.example.com/$1 [R=301,L] Options +FollowSymLinks DirectoryIndex index.php RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://www.example.com/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] if you are using an html extension on the home page chage the index.php to index.html in all places and change www.example.com to your domain name Edited September 26, 201213 yr by ELITE
September 26, 201213 yr Author Thank you elite From the way it looks how would that work for me? Im not sure if this is write like I explained When the user type my domain address in the following formats http://stiffnights.co.uk https://stiffnights.co.uk www.stiffnights.co.uk stiffnights.co.uk http://www.stiffnights.co.uk I want it to auto transfer to https://www,stiffnights.co.uk Thanks
September 26, 201213 yr try this RewriteEngine On RewriteCond %{HTTP_HOST} ^stiffnights.co.uk RewriteRule (.*) https://www.stiffnights.co.uk/$1 [R=301,L] Options +FollowSymLinks DirectoryIndex index.html RewriteBase / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ RewriteRule ^index\.html$ https://www.stiffnights.co.uk/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] looks like you do have an html file for the homepage put the above in the top of your htaccess file but back your htaccess file up first edit sorry this is just going redirect you to www.stiffnights.co.uk willl look into this if no one else can help Edited September 26, 201213 yr by ELITE
September 26, 201213 yr Author I know thanks but I want all to redirect Example: If I type http://stiffnights.co.uk should transfer to https://www.stiffnights.co.uk'>https://www.stiffnights.co.uk'>https://www.stiffnights.co.uk if I type http://www.stiffnights.co.uk should transfer to https://www.stiffnights.co.uk And so on. All should automatically trasnfer to SSL link https://www.stiffnights.co.uk
September 27, 201213 yr Try this: http://stackoverflow.com/questions/2015159/htaccess-redirect-for-non-www-both-http-and-https You might need to mash up this along with the "non www to www" rule... but it should work
September 28, 201213 yr i have it working for www. and http://www. will work on the rest tonight htaccess is not my stongest RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.stiffnights.co.uk/$1 [R,L] i will work on the rest tonight when baby is in bed
September 28, 201213 yr This should do all but one of them RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.stiffnights.co.uk/$1 [R,L] this is doing all that you want except https://stiffnights.co.uk I will try this later
September 28, 201213 yr Author For some reason I upload the new htaccess file with the new script you provide. RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.stiffnights.co.uk/$1 [R,L] I have the feeling my htaccess file is not executed I don't know driving my head in.
September 29, 201213 yr your using http://www.1and1.co.uk/ i would contact them ask if mod_rewrite is enabled are you on a windows server?
September 29, 201213 yr tried this? http://faq.1and1.com/dedicated_servers/root_server/ssl_certificates/5.html
September 29, 201213 yr just making sure I have the feeling my htaccess file is not executed I don't know driving my head in. you do have a dot first .htaccess just making sure
September 29, 201213 yr Author Ok after a little organizing this is my result. My .htaccess file is as follows:- DirectoryIndex index.html index.php # Use PHP5 Single php.ini as default AddType x-mapp-php5 .php RewriteEngine On RewriteCond %{http_host} ^mydomain.co.uk [nc] RewriteCond %{http_host} ^mydomain.co.uk [nc] RewriteRule ^(.*)$ https://www.mydomain.co.uk/ [r=301,nc] RewriteCond %{SERVER_PORT} 443 Now the results:- mydomain.co.uk ---> transfers to www.mydoamin.co.uk mydomain.co.uk/ ---> transfer to https://www.mydomain.co.uk www.mydoamin.co.uk ---> same no change www.mydoamin.co.uk http://mydomain.co.uk ---> transfers to www.mydomain.co.uk Now I think I have found out why it playing funny. If all of these are type in as follows: http://mydomain.co.uk/ https://mydomain.co.uk/ www.mydomain.co.uk/ mydomain.co.uk/ http://www.mydomain.co.uk/ They all transfer to https://www.mydomain.co.uk. The problem is a forward slash has to be present for the redirect to work. Is it possible to leave the .htaccess code the way it is and add more code so when the domains are typed in the address bar with out the forward slash they will also work to. Hope this is useful sorry for being a pest but I have to resolve this. Thank you
October 1, 201213 yr Author Never Mind People Fixed And Resolved The Issue, Thank You Who Ever Helped Awesome..
October 2, 201213 yr Author All The https:// Redirects work perfect. BUT I have 1 sub domain that also transfers to https:// I don't want to http://forum.mydomain.co.uk to transfer. But I want to leave the others.
Create an account or sign in to comment