2013-08-16 49 views
0

我在ubuntu m/c中使用apache2。我已啓用mod_rewrite並更改了apache2.conf中的Allowoveride Allhtaccess重寫規則無法在沒有index.php的url中工作

現在我試圖在我的服務器上安裝Bug-Genie應用程序 但以下.htaccess規則不起作用,例外。

我可以訪問:

http://localhost/roxsoft/thebuggenie-3.2.6/thebuggenie/**index.php**/wiki 

但我不能訪問:--404錯誤

http://localhost/roxsoft/thebuggenie-3.2.6/thebuggenie/wiki 

這裏是我的.htaccess文件:

# .htaccess file for The Bug Genie 

# make sure that magic_quotes and register_globals is always off 
<IfModule mod_php5.c> 
    php_flag magic_quotes_gpc off 
    php_flag register_globals off 
</IfModule> 

# rewrite rules 
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
# Example: 
# RewriteBase/
# or 
# RewriteBase /dev/thebuggenie 

    # skip all hidden files (starting with a .) 
    RewriteCond %{REQUEST_URI} \..+$ 
    RewriteCond %{REQUEST_URI} !\.(html|wsdl|json|xml)$ 
    RewriteRule .* - [L] 

    # redirect to front controller 
    RewriteRule ^(.*)$ index.php?url=$1 [NC,QSA,L] 

</IfModule> 
# Stop people accessing directories they shouldn't have access to 
RedirectMatch 403 ^/\.svn(/|$) 

回答

3

試試這個:

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^(index\.php|assets|images|robots\.txt) 
RewriteRule ^(.*)$ index.php/$1 [L] 

其中包含的JavaScript文件夾和CSS添加到重寫條件

+0

感謝快速回復..你的代碼工作正常但我需要篩選斷言文件,如CSS,JS,圖像等...隨着你的代碼每一個URL被重寫index.php/**** –

+0

謝謝....現在我明白了。 –

+0

如果有幫助http://meta.stackexchange.com/a/5235/201107,您可以接受答案。 @ baskar-m –

0

這是我剛和管理它的解決方案。這可以幫助,如果任何人有同樣的問題...

我只是刪除

,並加入htaccess的 這裏附加條件是:

RewriteCond %{REQUEST_URI} \..+$ 
    RewriteCond %{REQUEST_URI} !\.(html|wsdl|json|xml)$ 
    RewriteCond %{REQUEST_URI} !\.(jpg|png|css|js|php|gif|ttf|woff)$ ---- ADD FILTER CONDITION. 
    #RewriteRule .* - [L]            ---- COMMENT THIS LINE************ 

    # redirect to front controller 
    RewriteRule ^(.*)$ index.php?url=$1 [NC,QSA,L]