2013-05-01 2 views
1

.htaccess가 작동하지 않는 것 같습니다. 실제 파일이나 폴더가 아닌 index.php에있는 모든 URL을 다시 작성하려고합니다. 내가 시도하고 RewriteBase/CMS를 사용/마지막 라인을 변경하면이RewriteBase가 적용되지 않습니다.

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteRule ^index\.php$ - [L] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /cms/index.php [L] 
</IfModule> 

을 .htaccess로 사용할 때 나는에있어 디렉토리는/CMS는 재 작성에만 작동하는 것 같다. 될 운명처럼 /index.php [L]을 다시 쓰기가 localhost로 재 작성하지 않습니다// index.php에 대신가 다시 작성됩니다 CMS는 로컬 호스트/index.php에

답변

1

이 버전 사용해보십시오 :

RewriteEngine On 
RewriteBase /cms/ 

RewriteRule ^index\.php$ - [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php [L] 

상대 URI가로드되어 있는지 확인하기 위해 /index.php 대신 index.php을 RewriteBase와 함께 사용하고 있습니다.

+0

완벽하게 작동합니다. 나는 그것에 대해 생각하지 않았습니다. –