PHP启动脚本:Symfony 1.4:自定义域上的第二个应用程序?
主要应用:
~ec2-user/project/web/index.php
次要应用程式:
~ec2-user/project/web/api1.php
Apache配置:
-
0从
摘录:
<VirtualHost *:80> ServerName example.com DocumentRoot /home/ec2-user/project/web DirectoryIndex index.html index.php <Directory /home/ec2-user/project/web> AllowOverride All Allow from All </Directory> </VirtualHost> <VirtualHost *:80> ServerName 1.api.example.com # 1: version number DocumentRoot /home/ec2-user/project/web <Directory /home/ec2-user/project/web> AllowOverride None </Directory> RewriteEngine On RewriteRule ^(.*)$ /api1_dev.php [QSA,L] </VirtualHost>
~ec2-user/project/web/.htaccess
(应只适用于初级应用):Options +FollowSymLinks +ExecCGI <IfModule mod_rewrite.c> RewriteEngine On # uncomment the following line, if you are having trouble # getting no_script_name to work #RewriteBase/ # we skip all files with .something #RewriteCond %{REQUEST_URI} \..+$ #RewriteCond %{REQUEST_URI} !\.html$ #RewriteRule .* - [L] # we check if the .html version is here (caching) RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f # no, so we redirect to our front web controller RewriteRule ^(.*)$ index.php [QSA,L] </IfModule>
什么负载预期:
http://example.com
:主页http://example.com/api1.php/foo/bar
:一些JSON数据
什么不加载:
http://1.app.example.com/foo/bar
:404 |未找到| sfError404Exception
解析URL“/”(/)后为空模块和/或动作。
[...]
我缺少什么?
请注意,'的AllowOverride None'在'1.app.example.com'配置:'.htaccess'不解释,所以改变它没有效果。 – feklee