>  기사  >  PHP 프레임워크  >  yii 1.0에서 index.php를 숨기는 방법

yii 1.0에서 index.php를 숨기는 방법

藏色散人
藏色散人원래의
2021-03-16 10:07:416168검색

yii1.0에서 index.php를 숨기는 방법: 먼저 "httpd.conf" 파일을 연 다음 "mod_rewrite.so"를 열고 마지막으로 동일한 수준에서 해당 디렉터리의 "AllowOverride"를 변경합니다. index.php라는 디렉토리를 새로 만듭니다. .htaccess를 만듭니다.

yii 1.0에서 index.php를 숨기는 방법

이 문서의 운영 환경: Windows 7 시스템, yii 버전 1.0, DELL G3 컴퓨터

YII 1.0 단일 항목 index.php 숨기기 라우팅 및 의사 정적 설정

index.php 숨기기

Apache 구성 파일 확인 httpd.conf에서 LoadModule
rewrite_module 모듈/mod_rewrite.so 열기(# 제거)
해당 디렉터리의 AllowOverride를 ALL로 변경
루트 디렉터리에서 즉, 새 .htaccess

RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php

을 생성합니다. 루트 디렉터리, 즉 index.php와 동일한 디렉터리에 있음 main.php

// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'urlFormat'=>'path',
            'showScriptName' =>false,
			'rules'=>array(
                'index.html'=>array('index'),
                &#39;article/<id:\d+>&#39; => array(&#39;article/index&#39;,&#39;urlSuffix&#39;=>&#39;.html&#39;),
                &#39;category/<id:\d+>/<page:\d+>&#39; => array(&#39;category/index&#39;,&#39;urlSuffix&#39;=>&#39;.html&#39;),
                &#39;category/<id:\d+>/1&#39; => array(&#39;category/index&#39;,&#39;urlSuffix&#39;=>&#39;.html&#39;),
			),
		),

에 라우팅 규칙을 설정하세요. 권장 사항: "yii tutorial"

위 내용은 yii 1.0에서 index.php를 숨기는 방법의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.