![]() |
Apache HTTPS question
i setup SSL/TLS on apache 2.0.
Its working fine apache only listen on 443 port for incoming connections. My question is: How to config apache , for example when user type www.dome.com to automatic redirect him to port 443 and https connection. Now when i use www.domain.com he dont display anything because apache don listen on 80. |
You would need to setup another vhost to listen on port 80 and then use an apache rewrite to point at the https address:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html |
yes i create vhost form 80 port.
But rewrite is really complicated. Is there some simple rule for my problem? When i put in browser http://domain.com/test i wan to redirect me to https://domain.com/test |
This should work:
RewriteEngine on RewriteRule ^/(.*) https://domain.com/$1 |
i put in my host file in VirtualHost *:80
Code:
<Directory /var/www/> |
Sorry, I think it's my mistake - I forgot the remote (external redirect) option:
RewriteRule ^/(.*) https://212.61.33.32/$1 [R] |
heh i put that in vhost file..
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName x.x.x.x DocumentRoot /var/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all # Uncomment this directive is you want to see apache2's # default start page (in /apache2-default) when you go to / #RedirectMatch ^/$ /apache2-default/ #RedirectMatch permanent (/.*) https://x.x.x.x. RewriteEngine on RewriteRule ^/(.*) https://x.x.x.x./$1 [R] </Directory> <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> but same shit :) ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ |
| All times are GMT -5. The time now is 09:08 PM. |