Php .htaccess文件的重写规则
我需要在我的网站中编写重定向规则。我正在使用codeigniter。因此,它将对所有页面使用index.php。 所以我用的第一条规则是Php .htaccess文件的重写规则,php,.htaccess,Php,.htaccess,我需要在我的网站中编写重定向规则。我正在使用codeigniter。因此,它将对所有页面使用index.php。 所以我用的第一条规则是 RewriteRule^(.*)$/index.php/$1[L] 现在我想补充一些东西如下 首先,我的要求是: 输入-example.com/index.php/search/query 要重定向的url-example.com/search?q=query 以及 输入-example.com/index.php/search/query&c=abc&s=x
RewriteRule^(.*)$/index.php/$1[L]
现在我想补充一些东西如下
首先,我的要求是:
输入-example.com/index.php/search/query
要重定向的url-example.com/search?q=query
以及
输入-example.com/index.php/search/query&c=abc&s=xyz&p=1
要重定向的url-example.com/search?q=query&c=abc&s=xyz&p=1
就这样
有人能破解这个密码吗。?请
提前谢谢
编辑:告诉一些参考网站了解更多关于写入.htaccess文件的规则和条件语法。在html代码中,您必须这样编写:
<a href='http://www.domain.com/index/211/title-goes-here'>url_text</a>
使用()标记需要提取和使用的数据
使用$x,其中x=1,2,3
$x是值
你拥有的()越多,你拥有的x美元就越多
with:RewriteRule^(member)-(0-9-]+)$index.php?action=member&id=2[NC,L]
(成员)为$1,([0-9]+)为$2
你明白吗?谢谢你的投票,但是你明白我在那里写的吗?
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteRule ^([a-zA-Z-]+)$ index.php?action=$1 [NC,L]
RewriteRule ^(member)-([0-9-]+)$ index.php?action=member&id=$2 [NC,L]
RewriteRule ^([a-zA-Z-]+)/([a-zA-Z-]+)-([0-9-]+)$ index.php?action=$1&saction=$2&sid=$3 [NC,L]
RewriteRule ^([a-zA-Z-]+)/([0-9-]+)$ index.php?action=$1&id=$2 [NC,L]
RewriteRule ^([0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/(.*).html$ index.php?action=details&id=$1&p1=$2&p2=$3&p3=$4 [NC,L]