좋아, 막연한 질문 제목, 알아. 이것을 한 줄로 요약하는 방법을 모르겠다. CodeIgniter 설치에는 frontend와 admin의 두 가지 응용 프로그램이 있습니다. 올바른 응용 프로그램 폴더로 설정된 두 개의 전면 제어기가 있습니다. 현재, 프론트 엔드의 홈 페이지에는 index.php/home을 사용하고 관리 패널의 홈 페이지에는 admin.php/home을 사용합니다.특정 디렉토리의 URL을 어떻게 다시 쓸 수 있습니까?
필자는 프론트 엔드 URL에서 index.php를 삭제하려고합니다. admin cp의 경우 example.com/admin.php 대신 example.com/admin을 사용하고 싶습니다. 그래서 기본적으로 admin.php의 첫 번째 세그먼트로 admin을 가진 uri를 다시 작성해야합니다. 나는 내 htaccess에 RewriteRule ^admin/(.*)$ admin.php/$1
을 추가하는 것이 트릭을 할 것이라고 생각했지만 분명히 그렇지 않습니다 ... 어쨌든 완전히는 아닙니다. 내 관리자 cp에서 모든 페이지마다 404 페이지를 찾을 수 없습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
# Deny OR Allow Folder Indexes.
# Since we disable access to PHP files you
# can leave this on without worries.
# OR better yet, create a .htaccess file in
# the dir you want to allow browsing and
# set it to +Indexes
Options -Indexes
Options +FollowSymLinks
# Set the default file for indexes
DirectoryIndex index.php
<IfModule mod_rewrite.c>
# mod_rewrite rules
RewriteEngine on
# The RewriteBase of the system (if you are using this sytem in a sub-folder).
# RewriteBase /CodeIgniter_1.6.3/
# This will make the site only accessible without the "www."
# (which will keep the subdomain-sensive config file happy)
# If you want the site to be accessed WITH the "www."
# comment-out the following two lines.
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# If a controler can't be found - then issue a 404 error from PHP
# Error messages (via the "error" plugin)
# ErrorDocument 403 /index.php/403/
# ErrorDocument 404 /index.php/404/
# ErrorDocument 500 /index.php/500/
# Deny any people (or bots) from the following sites: (to stop spam comments)
# RewriteCond %{HTTP_REFERER} nienschanz\.ru [NC,OR]
# RewriteCond %{HTTP_REFERER} porn\.com
# RewriteRule .* - [F]
# Note: if you are having trouble from a certain URL just
# add it above to forbide all visitors from that site.
# You can also uncomment this if you know the IP:
# Deny from 192.168.1.1
# If the file is NOT the index.php file
RewriteCond %{REQUEST_FILENAME} !index.php
# Hide all PHP files so none can be accessed by HTTP
RewriteRule (.*)\.php$ index.php/$1
# If the file/dir is NOT real go to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
RewriteRule ^admin/(.*)$ admin.php/$1
</IfModule>
# If Mod_ewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
활성화하십시오를 [RewriteLog] (HTTP : //httpd.apache은 다음과 같습니다 그래서 당신은 또한 당신의 선택에
-Multiviews
을 추가해야합니다 .org/docs/2.2/mod/mod_rewrite.html # rewritelog) 로그 수준을 높이고 다시 시도한 후에 로그 파일을 게시하십시오. – ssnobody