Hi,
I'm looking for a way to be able to redirect a person who goes to http://www.domain.com/admin/index.htm to automatically be redirected to https://www.domain.com/admin/index.htm
Is there a way I can write this in .htaccess?
Many Thanks.
Hi,
I'm looking for a way to be able to redirect a person who goes to http://www.domain.com/admin/index.htm to automatically be redirected to https://www.domain.com/admin/index.htm
Is there a way I can write this in .htaccess?
Many Thanks.
Ok,
I did it with a really crude hack, in .htaccess I simply put the following line in:
Redirect permanent /admin/index.htm https://www.domain.com/admin/index_admin.htm
You can do this for all pages using the following in your .htacces file instead:
Code:RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
Jonathan Michaelson
Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Thanks chirpy,
I tried droping your code into my .htaccess file for domain.com/admin
but just kept getting a 404 error.
I must have done something wrong
Originally posted by chirpy
You can do this for all pages using the following in your .htacces file instead:
Code:RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)?$ https://%{SERVER_NAME}/$1 [L,R]
Odd. I just tested on a cPanel box and it worked fine. I even created a subdirectory called /admin and that worked too.
Ah, I've just reread your original post. I guess you'll be getting a 404 because at domain.com/admin/ you don't have an index.htm but a index_admin.htm, according to your post, anyway![]()
Jonathan Michaelson
Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
I have an index.php, but that should not make any difference...should it?
Thx.
If you browse to:
http://www.yourdomain.com/admin/index.php
Does it switch to https and work?
Jonathan Michaelson
Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Unfortunately not;
First I removed the redirect in .htaccess found in public_html folder, and then I copied your code exactly into the .htaccess file found in public_html/admin/ and I get a 404 error when going to http://www.domain.com/admin/index.php.
Thx again, appreciate any advice.
Ahhhhhh,
The code I mentioned was specifcally for the top level of the web root (i.e. in /public_html/.htaccess) it is intended for rerouting any requet on http:// to https:// for the whole domain.
To redirect just the /admin, you're probably better of using your original redirect if it works for you![]()
Jonathan Michaelson
Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Well thanks for your time, I will keep your code in mind if I need a total domain redirect in the future![]()
I use this :
<code>
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)?$ https://%{SERVER_NAME}%{REQUEST_URI}
</code>
And any redirect to subdomain without problem
It's me ...... It's me ......