|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Auto Forward From HTTP to HTTPS?
I'm setting up a SSL secured part of my web site. Now most people are used to typing "subdomain.domain.com" in the address bar. If I use SSLRequireSSL for this site, they'll normally get a 403 error. Users: Huh?
What I did to combat this is in my .htaccess: ErrorDocument 403 URL Is this appropriate/recommended? Is it possible that this will result in an endless loop. If this doesn't work, what kind of error should I expect in return? 500? Thanks |
|
#2
|
||||
|
||||
|
mod_rewrite might be a better solution if available.
Code:
RewriteEngine On RewriteRule ^(.*)$ https://subdomain.domain.com/$1 [R,L]
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
|
#3
|
|||
|
|||
|
You'll need a RewriteCond or something or it will just loop. I'm looking for a solution myself and can't get it to work. The closest suggestion is this from wirespeed, but it does not include the path/filename.
What I want is a rewriterule that automatically rewrites something like URL to URL |
|
#4
|
||||
|
||||
|
I guess the RewriteRule I wrote works for me b/c I have separate folders for my http and https docs, so if I put that rule in .htaccess in my http folder, when it rewrites, it's not in my https folder.
For those without this server structure, check the SERVER_PROTOCOL. Code:
RewriteEngine On
RewriteCond %{SERVER_PROTOCOL} ^[^https]$ [NC]
RewriteRule ^(.*)$ https://subdomain.domain.com/$1 [R,L]
|
|
#5
|
|||
|
|||
|
You can use RewriteCond %{SERVER_PORT} ^443$. Example can be found here
>> RewriteRule ^(.*)$ https://subdomain.domain.com/$1 [R,L] This could lead to a external redirect to https://subdomain.domain.com// (double slash) because ^(.*)$ portion has no slash. BTW, just because you are asking about HTTPS does not mean it is a security question. You should still post this kind of topic to Apache forum. Last edited by freebsd : March 14th, 2003 at 04:34 PM. |
|
#6
|
|||
|
|||
|
Works fine as an addition in httpd.conf but I can't get it to work in a .htaccess file.
I've got "Options +FollowSymLinks" and things like "ErrorDocument" and other stuff works in .htaccess. If the forum is inappropriate maybe a Mod could move the thread to wherever it belongs. It's the same to me, I use search anyway ![]() |
![]() |
| Viewing: Dev Shed Forums > System Administration > Security and Cryptography > Auto Forward From HTTP to HTTPS? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|