2012-10-12 56 views
6

我使用的是OJS,我已經將它安裝在名爲「journals」的文件夾中。我在那裏創建了一些期刊(例如「journal1」,「journal2」等)。mod-rewrite從url中刪除文件夾名稱

現在我得到的路徑是這樣的:www.example.com/journals/index.php/journal1www.example.com/journals/index.php/journal2

我想是映射www.example.com/journals/index.php/journal1 以貌似www.example.com/index.php/journal1(除去軸頸部分從URL)。

我無法將OJS移動到根目錄,因爲我在那裏有一些其他文件。

這裏是.htaccess文件,我使用目前(這是在「雜誌」文件夾,並給了我一個500)

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond $1 !^journals 
RewriteRule ^(.*) /journals/$1 [L] 
</IfModule> 

而且這裏是error.log中

[Fri Oct 12 22:16:45 2012] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 
+0

你有你的文檔根的'index.php'文件? –

+0

你的意思是項目根?或站點根?如果項目根 - 然後是,如果站點根 - 然後沒有。 – MBanerjee

+0

我的意思是站點根,就像是否「http:// www.example.com/index.php」實際解析爲現有資源一樣。 –

回答

3

當你將這些規則放在您的/journals目錄中的htaccess文件中,這會導致重寫循環。 $1永遠不會從期刊開始,因爲您位於期刊目錄內,因此規則不斷得到應用。

你需要把這樣的事情在你的htaccess的文件在您站點根目錄,在/目錄:

RewriteEngine On 
RewriteCond %{REQUEST_URI} !^/journals 
RewriteRule ^index\.php(.*)$ /journals/index.php$1 [L] 
+0

你知道什麼 - 它的工作。我不能感謝你足夠:)。 – MBanerjee

+0

嗨喬恩 - 它的工作fine.but現在都site/journal/index.php/journal1和網站/ index.php/journal1都可以訪問。如何禁用網站/期刊/ index.php/journal1部分,只有網站/索引.PHP/journal1 – MBanerjee