Forum Moderators: phranque

Message Too Old, No Replies

Redirect 443 to https

         

efendi

12:42 pm on May 19, 2009 (gmt 0)

10+ Year Member



hi everybody,
after great help here: [webmasterworld.com...] i'm little bit confused.

i can access my domain like this: www.domain.com:443
this call gives me a

Bad Request
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

how can i redirect it to [domain.com...]

thanks a lot
efendi

jdMorgan

6:05 pm on May 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The 500 Server error idicates that your ErrorDocument 400 directive is incorrect or that the error document is missing.

The solution depends heavily on your current configuration code in your server config files and in .htaccess, so we can't answer that question without seeing the specific directives related to your SSL and non-SSL VirtualHost configurations or knowing which of those files you intend to put the 'solution' code into.

Jim

efendi

7:05 pm on May 19, 2009 (gmt 0)

10+ Year Member



thanks jdMorgan,

is ist okay, if i post here my conf-file and the htaccess-file to compare? or is this to heavy for a public forum? both files are a little bit big.

regards
efendi

jdMorgan

8:42 pm on May 19, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, too heavy... No-one reads big chunks of code like that, so it's not very useful to post them.

We need to see just the two VirtualHost containers (SSL and non-SSL), plus the ErrorDocument configuration lines (if they are not in those VirtualHost sections), plus any .htaccess code related to these two pieces of the puzzle.

Thanks,
Jim

efendi

9:15 am on May 20, 2009 (gmt 0)

10+ Year Member



okay, jdMorgan, i will try it.

this is my conf-file:


NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
DocumentRoot "/home/sites/site4/web"
ServerName www.domain.com
ServerAlias www.domain.com

RewriteEngine On
RewriteOptions inherit
</VirtualHost>

<VirtualHost 127.0.0.1:443>
DocumentRoot "/home/sites/site4/web"
ServerName www.domain.com
Include /etc/apache2/vhosts.d/error.inc
RewriteEngine On
RewriteCond %{HTTP_HOST} !^127.0.0.1
RewriteCond %{HTTP_HOST} !^www.domain.com
RewriteRule ^/(.*) [domain.com...] [L,R]
Include /etc/apache2/vhosts.d/rw_huw.inc
RewriteOptions inherit

SSLEngine On
SSLCertificateFile /home/sites/site4/certs/www.domain.com.crt
SSLCertificateKeyFile /home/sites/site4/certs/key
SSLCACertificateFile /home/sites/site4/certs/intermediate.crt
</VirtualHost>

and this is the htaccess-file


RewriteEngine On
# Redirect non-POST requests for index.php, index.html, or index.htm to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.(html?¦php)\ HTTP/
RewriteCond %{REQUEST_METHOD} !^POST
RewriteCond %{SERVER_PORT}s ^(443(s)¦[0-9]+s)$
RewriteRule ^index\.(html?¦php)$ http%2://www.domain.com/ [R=301,L]

# If requested hostname is not IP address, exact canonical domain, or
# blank (for HTTP/1.0), redirect requests to canonical domain
RewriteCond %{HTTP_HOST} !^127.0.0.1$
RewriteCond %{HTTP_HOST} !^(www\.domain\.com)?$
RewriteCond %{SERVER_PORT}s ^(443(s)¦[0-9]+s)$
RewriteRule (.*) http%2://www.domain.com/$1 [R=301,L]

# Serve alternate robots.txt for SSL requests
RewriteCond %{SERVER_PORT} =443
RewriteRule ^robots\.txt robots_ssl.txt [L]

thank you
efendi

efendi

12:58 pm on Jun 2, 2009 (gmt 0)

10+ Year Member



May I remind to this thread?

sorry and thanks