为codeigniter多的.htaccess重写规则 [英] .htaccess multiple rewrite rules for codeigniter
问题描述
我想问问怎样才能加入.htaccess文件包括codeigniter index.php的去除规律额外的重写规则(S)。
I want to ask how can we add an additional rewrite rule(s) in .htaccess file including the index.php removal rule in codeigniter.
下面是我的.htaccess文件
Here is my .htaccess file
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
的问题是,只有一个规则的工作的时间。如果我将文件保存如上图返回内部服务器错误!
The problem is that, only one of the rule works at a time. If I save the file as shown above it returns internal server error!
我要的是彻底删除index.php文件以及重写从xyz.com/front/profileDetail/50网址到xyz.com/profile/50
What I want is completely remove index.php file plus rewrite the url from xyz.com/front/profileDetail/50 into xyz.com/profile/50
请帮忙出了什么问题,我完全新手在这方面的工作。
Please help what's wrong, I am completely newbie in this regard.
谢谢!提前。
推荐答案
要阐述我的上述评论,在配置/路线,你会放:
To elaborate on my comment above, in config/routes, you would put:
$route['profile/(:num)'] = 'front/profileDetail/$1';
这篇关于为codeigniter多的.htaccess重写规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!