New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Https redirection help !!!
I have been trying to redirect my site to https and also from non www to www but It works on the root domain but the .htaccess I place on the website's root directory doesn't effect the sub directory hence.. the sub directory aren't redirected to https or from non www to www
Please kindly help
Comments
I am using Godady cPanel Hosting.
And looks like no inheritance to the sub directories
You've got your .htaccess wrong.
pastebin your .htaccess so people can help
Hey man, use this.
SSL Rewrite
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
my .htaccess is blank.. I haven;t setup any redirection rules for now...
@Shivam this doesn't work
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Simple
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.yoursite.tld/$1 [R,L]
@adxn it works for the root directory but doesn't work for yoursite.tld/subdomain Any other clues ?
Works for me mate.
While issuing your SSL make sure to use the following format www.yoursite.tld as domain name
and for subdomain u must have a wildcard SSL
for sub directory add that .htaccess there too
I was sorry I was referring to sub directory and not a sub domain, my sincere apologies.
Place the same .htaccess on your sub directory as well
When I add the .htaccess in the sub directory should I place it like following
or
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://readydedi.com/$1 [R,L]
thank you BharatB will it also work for the sub domain.. the .htaccess on the root domain doesn't get inherited by the subdirectories
.htaccess files are read recursively. If it does not impact a sub directory this means that you have overriding configuration for that sub directory in a .htaccess file or virtual host. Also possible your application triggers a redirect in its code.
I do agree @jar , The above .htaccess will work for subdomains as if your ssl type is wildcard ssl. If not you will get an error for subdomains.
If you are using .htaccess specifically in subdirectories you have to add the code to .htaccess of subdirectories, if not there is no need to add .htaccess file in the subdirectories. Check your code and find where the absalute path is defined for the http.
Maybe this will help you: http://www.askapache.com/htaccess/http-https-rewriterule-redirect.html
Good luck!