[g5] 그누보드 .htaccess https 수정하기
본문
uri.lib.php
function get_mod_rewrite_rules($return_string=false){
$get_path_url = parse_url(G5_URL);
$base_path = isset($get_path_url['path']) ? $get_path_url['path'].'/' : '/';
$rules = array();
$rules[] = 'ErrorDocument 401 /401.html';
$rules[] = 'ErrorDocument 403 /403.html';
$rules[] = 'ErrorDocument 404 /404.html';
$rules[] = 'ErrorDocument 500 /500.html';
$rules[] = 'ErrorDocument 502 /502.html';
$rules[] = 'ErrorDocument 503 /503.html';
$rules[] = '';
$rules[] = 'RewriteEngine On';
$rules[] = '';
$rules[] = 'RewriteCond %{REQUEST_URI} !^(/index\.php|/img/|/js/|/robots\.txt|/favicon\.ico)';
$rules[] = 'RewriteCond %{REQUEST_FILENAME} !-f';
$rules[] = 'RewriteCond %{REQUEST_FILENAME} !-d';
$rules[] = '';
$rules[] = '<IfModule mod_rewrite.c>';
$rules[] = '# Redirect';
$rules[] = 'RewriteEngine On';
$rules[] = 'RewriteBase '.$base_path;
$rules[] = '';
$rules[] = '# Redirect www to Non-www';
$rules[] = 'RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]';
$rules[] = 'RewriteRule ^(.*)$ https://%1/$1 [L,R=301]';
$rules[] = '';
$rules[] = '# SSL';
$rules[] = 'RewriteCond %{HTTPS} off';
$rules[] = 'RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]';
$rules[] = '</IfModule>';
$rules[] = '';
$rules[] = '#### '.G5_VERSION.' rewrite BEGIN #####';
$rules[] = '<IfModule mod_rewrite.c>';
$rules[] = 'RewriteEngine On';
$rules[] = 'RewriteBase '.$base_path;
$rules[] = 'RewriteCond %{REQUEST_FILENAME} -f [OR]';
$rules[] = 'RewriteCond %{REQUEST_FILENAME} -d';
$rules[] = 'RewriteRule ^ - [L]';
if( $add_rules = run_replace('add_mod_rewrite_rules', '', $get_path_url, $base_path, $return_string) ){
$rules[] = $add_rules;
}
$rules[] = 'RewriteRule ^content/([0-9a-zA-Z_]+)$ '.G5_BBS_DIR.'/content.php?co_id=$1&rewrite=1 [QSA,L]';
$rules[] = 'RewriteRule ^content/([^/]+)/$ '.G5_BBS_DIR.'/content.php?co_seo_title=$1&rewrite=1 [QSA,L]';
$rules[] = 'RewriteRule ^rss/([0-9a-zA-Z_]+)$ '.G5_BBS_DIR.'/rss.php?bo_table=$1 [QSA,L]';
$rules[] = 'RewriteRule ^([0-9a-zA-Z_]+)$ '.G5_BBS_DIR.'/board.php?bo_table=$1&rewrite=1 [QSA,L]';
$rules[] = 'RewriteRule ^([0-9a-zA-Z_]+)/([^/]+)/$ '.G5_BBS_DIR.'/board.php?bo_table=$1&wr_seo_title=$2&rewrite=1 [QSA,L]';
$rules[] = 'RewriteRule ^([0-9a-zA-Z_]+)/write$ '.G5_BBS_DIR.'/write.php?bo_table=$1&rewrite=1 [QSA,L]';
$rules[] = 'RewriteRule ^([0-9a-zA-Z_]+)/([0-9]+)$ '.G5_BBS_DIR.'/board.php?bo_table=$1&wr_id=$2&rewrite=1 [QSA,L]';
$rules[] = '</IfModule>';
$rules[] = '#### '.G5_VERSION.' rewrite END #####';
return $return_string ? implode("\n", $rules) : $rules;
}
댓글목록 0
등록된 댓글이 없습니다.