url 설정 설명문 수정
This commit is contained in:
@@ -30,6 +30,9 @@ add_javascript('<script src="'.G5_JS_URL.'/remodal/remodal.js"></script>', 10);
|
||||
<div class="local_desc02 local_desc">
|
||||
<p>
|
||||
게시판과 컨텐츠 페이지에 짧은 URL 을 사용합니다.
|
||||
<?php if( ! $is_write_file && check_need_rewrite_rules() ) { // apache인 경우 ?>
|
||||
<br>짧은 주소 사용시 아래 Apache 설정 코드를 참고하여 설정해 주세요.
|
||||
<?php } ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -77,7 +80,7 @@ add_javascript('<script src="'.G5_JS_URL.'/remodal/remodal.js"></script>', 10);
|
||||
|
||||
<h4 class="copy_title">.htaccess 파일에 적용할 코드입니다.
|
||||
<?php if( ! $is_write_file ) { ?>
|
||||
<br>자동으로 .htaccess 파일을 수정 할수 있는 권한이 없습니다.<br>아래 코드를 복사하여 .htaccess 파일이 없다면 생성 후에, 아래 내용을 복사 붙여넣기 해 주세요.
|
||||
<br>자동으로 .htaccess 파일을 수정 할수 있는 권한이 없습니다.<br>.htaccess 파일이 없다면 생성 후에, 아래 코드가 없으면 코드를 복사하여 붙여넣기 해 주세요.
|
||||
<?php } ?>
|
||||
</h4>
|
||||
<textarea readonly="readonly" rows="10"><?php echo get_mod_rewrite_rules(true); ?></textarea>
|
||||
|
||||
+29
-4
@@ -293,7 +293,7 @@ function get_nginx_conf_rules($return_string=false){
|
||||
|
||||
$rules = array();
|
||||
|
||||
$rules[] = '#### '.G5_VERSION.' url rules BOF #####';
|
||||
$rules[] = '#### '.G5_VERSION.' nginx rules BEGIN #####';
|
||||
$rules[] = 'if (!-e $request_filename){';
|
||||
|
||||
if( $add_rules = apply_replace('add_nginx_conf_rules', '', $get_path_url, $base_path, $return_string) ){
|
||||
@@ -308,7 +308,7 @@ function get_nginx_conf_rules($return_string=false){
|
||||
$rules[] = "rewrite ^{$base_path}([0-9a-zA-Z_]+)/([^/]+)/$ {$base_path}bbs/board.php?bo_table=$1&wr_seo_title=$2&rewrite=1 break;";
|
||||
$rules[] = "rewrite ^{$base_path}([0-9a-zA-Z_]+)/([0-9]+)$ {$base_path}bbs/board.php?bo_table=$1&wr_id=$2&rewrite=1 break;";
|
||||
$rules[] = '}';
|
||||
$rules[] = '#### '.G5_VERSION.' url rules EOF #####';
|
||||
$rules[] = '#### '.G5_VERSION.' nginx rules END #####';
|
||||
|
||||
return $return_string ? implode("\n", $rules) : $rules;
|
||||
}
|
||||
@@ -321,7 +321,7 @@ function get_mod_rewrite_rules($return_string=false){
|
||||
|
||||
$rules = array();
|
||||
|
||||
$rules[] = '#### '.G5_VERSION.' rewrite BOF #####';
|
||||
$rules[] = '#### '.G5_VERSION.' rewrite BEGIN #####';
|
||||
$rules[] = '<IfModule mod_rewrite.c>';
|
||||
$rules[] = 'RewriteEngine On';
|
||||
$rules[] = 'RewriteBase '.$base_path;
|
||||
@@ -341,11 +341,36 @@ function get_mod_rewrite_rules($return_string=false){
|
||||
$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 EOF #####';
|
||||
$rules[] = '#### '.G5_VERSION.' rewrite END #####';
|
||||
|
||||
return $return_string ? implode("\n", $rules) : $rules;
|
||||
}
|
||||
|
||||
function check_need_rewrite_rules(){
|
||||
$is_apache = (stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false);
|
||||
|
||||
if($is_apache){
|
||||
$save_path = G5_PATH.'/.htaccess';
|
||||
|
||||
if( !file_exists($save_path) ){
|
||||
return true;
|
||||
}
|
||||
|
||||
$rules = get_mod_rewrite_rules();
|
||||
|
||||
$bof_str = $rules[0];
|
||||
$eof_str = end($rules);
|
||||
|
||||
$code = file_get_contents($save_path);
|
||||
|
||||
if( strpos($code, $bof_str) === false || strpos($code, $eof_str) === false ){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function update_rewrite_rules(){
|
||||
|
||||
$is_apache = (stripos($_SERVER['SERVER_SOFTWARE'], 'apache') !== false);
|
||||
|
||||
Reference in New Issue
Block a user