2012-09-05 182 views
1

我要問我們如何才能增加在.htaccess文件包括笨在index.php去除規則額外的重寫規則(一個或多個)。的.htaccess多個重寫規則笨

這裏是我的.htaccess文件

RewriteEngine on 

RewriteCond $1 !^(index\.php|images|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^profile/([0-9]+)$ /index.php/front/profileDetail/$1 
RewriteRule ^(.*)$ /index.php/$1 

的問題是,只有規則的一個工作在同一時間。如果我保存上面顯示的文件,它將返回內部服務器錯誤!

我想完全是刪除index.php文件加上改寫從xyz.com/front/profileDetail/50鏈接到xyz.com/profile/50

請大家幫忙出了什麼問題,我在完全新手對此。

謝謝!提前。

+1

我會用改寫路由(配置/ routes.php文件)'xyz.com /正面/ profileDetail/50'到'xyz.com/profile/50',而不是.htaccess。 – Mudshark

回答

3

要闡述我的評論上面,在配置/路線,你會放:

$route['profile/(:num)'] = 'front/profileDetail/$1'; 
+0

謝謝!我認爲你使用CI路由重寫url的建議比我更接受,而不是使用.htaccess。 謝謝!再次很多。 –

+0

@DipenGrg很高興幫助你。請點擊旁邊的複選標記接受我的答案爲「解決」 - thx :) – Mudshark