Symfony2 + AngularJS 允许路由
Symfony2 + AngularJS allow route
我有一个具有这种结构的 Symfony2 项目(包括 angularjs 项目):
Project (Symofony2)
|_ app
|_ ...
|_ src
| |_ Bundle
| |_ Resources
| |_ Views
| |_ template.html.twig
|_ web
|_ public
|_ app.php
|_ app_dev.php
|_ project_angularjs (AngularJS working project)
我的 AngularJS 项目有这个 URL 来执行项目:
http://v/Project/web/project_angularjs/#/ad/0
(#/ad/0
--> 是参数)
我的 template.html.twig 有这个代码:
<iframe src="http://v/Project/web/project_angularjs/#/ad/0">
</iframe>
但只有当我发送它时它才有效(没有参数并指定 index.html):
http://v/Project/web/project_angularjs/index.html
<iframe src="http://v/Project/web/project_angularjs/index.html">
</iframe>
当我执行第一个 URL 时出现 "Forbidden" 错误,当执行第二个时有页面但没有参数...我试图在 .htaccess 中允许此路由 / web 文件夹但未成功。
如何允许参数和这条路线?
为了解决这个错误,我更新了 web 文件夹的 .htaccess 文件:
DirectoryIndex index.html #app.php
<IfModule mod_rewrite.c>
RewriteEngine Off #On
...
</IfModule>
我有一个具有这种结构的 Symfony2 项目(包括 angularjs 项目):
Project (Symofony2)
|_ app
|_ ...
|_ src
| |_ Bundle
| |_ Resources
| |_ Views
| |_ template.html.twig
|_ web
|_ public
|_ app.php
|_ app_dev.php
|_ project_angularjs (AngularJS working project)
我的 AngularJS 项目有这个 URL 来执行项目:
http://v/Project/web/project_angularjs/#/ad/0
(#/ad/0
--> 是参数)
我的 template.html.twig 有这个代码:
<iframe src="http://v/Project/web/project_angularjs/#/ad/0">
</iframe>
但只有当我发送它时它才有效(没有参数并指定 index.html): http://v/Project/web/project_angularjs/index.html
<iframe src="http://v/Project/web/project_angularjs/index.html">
</iframe>
当我执行第一个 URL 时出现 "Forbidden" 错误,当执行第二个时有页面但没有参数...我试图在 .htaccess 中允许此路由 / web 文件夹但未成功。
如何允许参数和这条路线?
为了解决这个错误,我更新了 web 文件夹的 .htaccess 文件:
DirectoryIndex index.html #app.php
<IfModule mod_rewrite.c>
RewriteEngine Off #On
...
</IfModule>