View Full Version : .htaccess
bothavia
05-15-2010, 11:10 PM
I recently installed a SSL certificate on my server and i have been working on a redirect to rewite it to https when you use the name with or with out www. does anyone have any suggestions.
protected void Page_Load(object sender, EventArgs e)
{
if (Request.IsSecureConnection)
{
string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
Response.Redirect(redirectUrl);
}
}
asp.net
Phegan
05-16-2010, 01:17 AM
Let me look through some of my old code, but you can do it in PHP too. I know I have done it via .htaccess files.
but..
if(!$_SERVER['https'] == 'on'){
header("Location:https://$uri");
exit;
}
That's not 100% perfect, but something very similar
lornfang
05-16-2010, 03:30 AM
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]
That should do it I believe, you might have to tweak the regex, I'm a little too drunk atm to care.
Bonzo
05-16-2010, 10:28 AM
Maybe he should specify which platform/language he needs this in?
Phegan
05-16-2010, 10:29 AM
If he wants an .htaccess, he wants it in apache, Lornfang has provided.
bothavia
05-16-2010, 04:11 PM
Yea its apache regex the one i have been working on is something like this:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com$ [NC]
RewriteRule ^(.*)$ https://www.mydomain.com/$1 [R=302,L]
It has to rewrite if both forms of the website are use without https,
ex www.mydomain.com and mydomain.com
Question no. 2
I also have to make a php.ini file to set upload limits. I have no knowledge of php
so i dont wanna mess anything up i know it should look something like this but not sure
<?php
memory_limit = 64M
post_max_size = 64M
file_uploads = On
upload_max_filesize = 64M
engine = On
short_open_tag = Of
output_buffering = Off
output_buffering = 2048
expose_php = False
include_path = ".:/usr/local/lib/php/pear:"
error_reporting = E_ALL
display_errors = Off
log_errors = On
error_log = "error.log"
safe_mode = On
safe_mode_include_dir = /usr/local/lib/php/safe-include
safe_mode_exec_dir = /usr/local/lib/php/safe-bin
register_globals = Off
max_input_time = 90
register_argc_argv = false
register_long_arrays = false
ini_set('max_execution_time', 600);
?>
Mabe i have added too much or its out of order not sure. Im running a joomla site and i just need to be able to upload larger pictures atm.
daayou
05-16-2010, 04:43 PM
upload_max_filesize = 64M
That is the line.
If these are just images, 64m is MASSIVE :)
max_input_time is 90 seconds which if you are uploading 64MB most people can't upload that much in 90 seconds
vBulletin® v3.7.7, Copyright ©2000-2012, Jelsoft Enterprises Ltd.