Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.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
修改.htaccess以允许ajax访问一个文件_Ajax_.htaccess_Codeigniter - Fatal编程技术网

修改.htaccess以允许ajax访问一个文件

修改.htaccess以允许ajax访问一个文件,ajax,.htaccess,codeigniter,Ajax,.htaccess,Codeigniter,我有一个网站www.myurl.com 它的布局如下 /home/html/.htaccess /home/html/application /home/html/application/.htaccess /home/html/application/controllers/stats.php /home/html/.htaccess包含: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_F

我有一个网站www.myurl.com

它的布局如下

/home/html/.htaccess
/home/html/application
/home/html/application/.htaccess
/home/html/application/controllers/stats.php
/home/html/.htaccess包含:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php?$1 [L]
/home/html/application/.htaccess包含:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L]
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php?$1 [L]
我不知道这是否重要,但该网站是由CodeIgniter提供动力的

这是我的问题,我正在进行以下Ajax调用:

                   $.ajax({
                   url: '<?php echo site_url('stats/get_stuff')?>',
                   type:'POST',
                   data: { parm1 : "parm1", 
                           parm2 : "parm2",
                           parm3 : "parm3" }, 
                   dataType: 'json',
                   success: function(output_string){
                   }

<?php echo site_url('stats/get_stuff')?> returns: 


http://www.myurl.com/stats/get_stuff
$.ajax({
url:“”,
类型:'POST',
数据:{parm1:“parm1”,
parm2:“parm2”,
parm3:“parm3”},
数据类型:“json”,
成功:函数(输出字符串){
}
返回:
http://www.myurl.com/stats/get_stuff
Ajax调用会产生以下错误:

401未经授权

我很确定我必须修改一个或两个.htaccess文件,但我不确定是哪一个,最重要的是我必须修改什么


有人能提供任何建议吗?

在change.htaccess之前,尝试在
config.php
文件上设置
$config['index\u page']='index.php'
;请参阅以获取答案