2015-11-07 86 views
0

我在我的子域中有以下.htaccess文件。 我的網站有http://hello/forum/index.php,想隱藏這個index.php文件,並將它製作成http://hello/forum從子域中刪除index.php

每當我使用附加的.htaccess時,它將指向http://hello而不是http://hello/forum。我錯過了什麼嗎?

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] 
    RewriteCond %{REQUEST_URI} !/system/.* [NC] 
    RewriteRule (.*?)index\.php/*(.*) forum/$1$2 [R=301,NE,L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ forum/index.php/$1 [L] 
</IfModule> 

回答

1

嘗試下列規則:

RewriteCond %{THE_REQUEST} ^GET\ /(forum)/index\.php [NC] 
RewriteRule^/%1 [R=301,L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /forum/index.php/$1 [L] 
+0

不幸的是,它沒有工作...我還需要檢查http://你好的htaccess文件嗎? –

0

我能夠在.htaccess文件中添加

DirectoryIndex index.php index.html 

來解決這個問題。