Php Apache将查询字符串重写为类似CodeIgniter的URL
下面是一个带有查询字符串的示例URL。Php Apache将查询字符串重写为类似CodeIgniter的URL,php,.htaccess,codeigniter,mod-rewrite,query-string,Php,.htaccess,Codeigniter,Mod Rewrite,Query String,下面是一个带有查询字符串的示例URL。关键字是用户在我的网站中搜索或从其他网站、搜索引擎等重定向的任何内容 和等效的CodeIgniter URL (搜索=控制器,现在= (方法) 如何在Apache.htaccess中重写URL以创建类似CodeIgniter的URL RewriteRule ^/?search/now/(.*)$ /search\.php?q=$1 或您可以隐藏url查询 RewriteRule ^search.php?id=(.*)$ /search.php [L,R=
关键字是用户在我的网站中搜索或从其他网站、搜索引擎等重定向的任何内容
和等效的CodeIgniter URL
(搜索=控制器,现在=
(方法)
如何在Apache.htaccess中重写URL以创建类似CodeIgniter的URL
RewriteRule ^/?search/now/(.*)$ /search\.php?q=$1
或您可以隐藏url查询
RewriteRule ^search.php?id=(.*)$ /search.php [L,R=301]
首先,您不希望指向php文件。CI只有index.php,如果您不顾一切,可以将所有search.php指向index.php
我会在这个基础上处理它
将表单发布到控制器,使用表单验证使输入安全,获取变量并像这样使用重定向函数
redirect('/search/'.$this->input->post('q') );
你确定这就是你想要的吗?