これは私のフォルダ構造です:AngularJS + PHPのAPI
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule^- [L]
RewriteRule ^/api/ ../api/api.php
# If the requested resource doesn't exist, use index.html
RewriteRule^/index.html
だから、私はこれをしたい:http://localhost
にアクセスするだけで、私のindex.html
返し、次のように
myproject/
api/
api.php
public/
.htaccess
index.html
scripts/
... all my angular stuff...
私の.htaccessがあります。しかし、私のapi.php
ファイルで処理する必要がある私のAngularJs scrips内のAjaxコール/api/something
。
現在、私のApache仮想ホストはmyproject/public
を指しています。 http://localhost
にアクセスするとindex.htmlが返されますが、/api/something
にもindex.htmlが返されます。 api.php
に決して届かないようです。何か案は?
にとして、私はあなたがapaを打つとき、相対性は働かないと思ったこれは、.. /apiの可能な解決方法を参照してください:http://stackoverflow.com/a/21324642/3802077 – user3802077
Cool。私は家に到着したらそれを試してみる。ありがとう! –