Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 添加斜杠时htaccess规则不起作用_Php_Apache_.htaccess_Codeigniter_Mod Rewrite - Fatal编程技术网

Php 添加斜杠时htaccess规则不起作用

Php 添加斜杠时htaccess规则不起作用,php,apache,.htaccess,codeigniter,mod-rewrite,Php,Apache,.htaccess,Codeigniter,Mod Rewrite,我的主域指向/html文件夹,该文件夹中除了一个.htaccess文件外没有任何内容 我在/html/manage文件夹中有一个CodeIgniter网站 这是htaccess文件内容 RewriteEngine on RewriteBase / RewriteRule ^pg/(.*)$ /manage/product_groups [L,QSA] 这不起作用,它显示了codeigniter的404错误页面 (如果我直接从浏览器访问website.com/manage/product_gr

我的主域指向
/html
文件夹,该文件夹中除了一个
.htaccess
文件外没有任何内容

我在
/html/manage
文件夹中有一个CodeIgniter网站

这是htaccess文件内容

RewriteEngine on
RewriteBase /

RewriteRule ^pg/(.*)$ /manage/product_groups [L,QSA]
这不起作用,它显示了codeigniter的404错误页面

(如果我直接从浏览器访问website.com/manage/product_groups,效果很好)

如果我做了
RewriteRule^pg/(.*)$/manage[L,QSA]
,那么它工作正常,实际上这个页面有CI的登录页面


我的主要目标是将每个请求从
website.com/pg/
重定向到
website.com/manage/product\u groups
我不知道您是否有特殊情况

就是说,


可能需要进行一些试验。

您检查了产品组是否存在并且是否具有正确的权限?@Shipping是的,我告诉了
(如果我直接从浏览器访问website.com/manage/product\u groups,它工作得很好)
。。。我在那个URL上设置了一条测试消息,它显示我是否从浏览器访问它directly@Shiping另外请注意
如果我重写规则^pg/(.*)$/manage[L,QSA],那么它就可以正常工作,实际上,此页面有CI的登录页面。
很抱歉,我错过了您在一个位置所说的内容,误解了您在第二个位置所说的内容。在routes表中执行此操作如何?比如
$route['pg']='manage/product_groups'
$route['pg/(:any)]='manage/product_group'
$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

$route['pg'] = 'manage/product_groups';
$route['pg/(:any)'] = 'manage/product_groups';