Restler setup not working

时间:2016-04-21 21:53:09

标签: apache restler

On my webserver running Apache/2.2.26 (Unix) DAV/2 PHP/5.4.24 mod_ssl/2.2.26 OpenSSL/0.9.8y I am trying to setup Restler but it can't seem to handle the index.php properly. This is a webapp setup with an httpd.conf that looks like so:

Alias "/dts2" "/usr/local/WebApps/DTS/root"

<Directory "/usr/local/WebApps/DTS/root">
  AllowOverride All
  Options -Indexes FollowSymLinks
</Directory>

So then I went into that 'root' directory and ran this command to install restler:

composer create-project restler/application=dev-basic api --prefer-dist

After that, in the 'api' directory I created my .htaccess file that looks like so:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteRule ^$ public/index.php [QSA,L]
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)$ public/index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
    php_flag display_errors On
</IfModule>

And, finally when I try to access "https://..../dts2/api/Home/" to get the success message that restler provides, I get a 404 error.

What have I done wrong?

1 个答案:

答案 0 :(得分:0)

好的,终于搞定了。有两个问题。

一个是Restler本身。提供的index.php表示$r->addAPIClass('Home', '');。我不得不删除第二个空参数。

另一个是阿帕奇。而不是在RewriteRule上说public/index.php,我不得不说/dts2/api/public/index.php

一旦我完成了这两项更改,一切都按预期工作。

相关问题