对笨的.htaccess多个重写规则(.htaccess multiple rewrite rule

2019-10-17 04:45发布

我想问一下我们如何才能增加在.htaccess文件包括笨在index.php去除规则额外的重写规则(一个或多个)。

这里是我的.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

问题是,只有规则的一个工作在同一时间。 如果我将文件保存如上图所示,它返回内部服务器错误!

我想完全是从xyz.com/front/profileDetail/50删除index.php文件加上重写URL到xyz.com/profile/50

请大家帮忙出了什么问题,我在这方面完全新手。

谢谢! 提前。

Answer 1:

为了阐述我的意见之上,在配置/路线,你会放:

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


文章来源: .htaccess multiple rewrite rules for codeigniter