我用phalcon PHP和AngularJs使用简单的应用程序。 我想通过AJAX POST请求从angularJS控制器调用我的phalcon PHP控制器。
$http.post('/ControllerName/', {params});我得到了
404在此服务器上找不到请求的URL / ControllerName /
我认为我的请求被路由到我的公共文件夹,而我的php控制器位于非公用文件夹。
这些是我拥有的.htaccess规则
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L]</IfModule>并在公用文件夹中:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]</IfModule>我究竟做错了什么?
i am using simple app with phalcon PHP and AngularJs. i am trying to call my phalcon PHP controller from angularJS controller through AJAX POST request.
$http.post('/ControllerName/', {params});and i get
404 The requested URL /ControllerName/ was not found on this server
i think my request is being routed to my public folder whereas my php controller is located in Non-public folder.
these are the .htaccess rules i have
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule (.*) public/$1 [L]</IfModule>and in the public folder:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]</IfModule>what am i doing wrong?
最满意答案
好的,我的问题是在我认为的重写机制中。 首先,在httpd.conf文件中我必须:
将“AllowOverride None”更改为相关目录中的“AllowOverride All”。 我的“mod_rewrite”被禁用,所以我不得不注释该行:“#LoadModule rewrite_module modules / mod_rewrite.so”Ok, My problem was in the rewrite mechanism as i thought. First, in httpd.conf file i had to:
Change "AllowOverride None" to "AllowOverride All" in the relevant directory. My "mod_rewrite" was disabled, so i had to un-comment the line: "# LoadModule rewrite_module modules/mod_rewrite.so"更多推荐
发布评论