Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在web服务器中安装Symfony2_Symfony - Fatal编程技术网

在web服务器中安装Symfony2

在web服务器中安装Symfony2,symfony,Symfony,我正在尝试在web服务器中安装Symfony2,但我有一个关于URL的问题 我想在这个url中安装它 http://mywebsite.com/gestor 那么,是否可以将分配在/web文件夹中的文件放入此目录gestor,并将其他文件/app、/bin、/src…放入服务器的另一个路径中,使其成为私有文件,并且无法通过URL访问 哪种方式最好?就这么做,修改app.php所需的吗?我会尽力帮你,但我不是这方面的专家?您是安装在共享主机还是专用主机上 如果你在一个专门的主机上,你可以去 但我

我正在尝试在web服务器中安装Symfony2,但我有一个关于URL的问题

我想在这个url中安装它

http://mywebsite.com/gestor
那么,是否可以将分配在/web文件夹中的文件放入此目录gestor,并将其他文件/app、/bin、/src…放入服务器的另一个路径中,使其成为私有文件,并且无法通过URL访问


哪种方式最好?就这么做,修改app.php所需的吗?

我会尽力帮你,但我不是这方面的专家?您是安装在共享主机还是专用主机上

如果你在一个专门的主机上,你可以去

但我假设您安装在一个共享主机上,由KBrogan提供: 有谁能告诉我如何将www.site.com/appname/web/app.php改写为更性感的www.site.com url,该url将自动重定向到www.site.com/appname。。。不检查长版本的url

<bernardnapoleon> i've been googling for hours now. >><
<helios_ag> r u  on shared hosting?
<bernardnapoleon> yes
<KBrogan> bernard, i have just the solution for you if you would like everything redirected to site.com/index.php with your content stored in webroot/Symfony
<bernardnapoleon> really? you're amazing!
<bernardnapoleon> that's it
<KBrogan> 1) move Symfony/web to webroot/
<bernardnapoleon> okay but wouldn't that break the folder structure of symfony?
<KBrogan> nope
<KBrogan> 2) change the require_once tags in both files webroot/app(_dev)?.php to point to Symfony/app/... instead of pointing to ../Symfony/app
<KBrogan> example: require_once __DIR__.'/Symfony/app/AppKernel.php';
<bernardnapoleon> oks! done
<KBrogan> make .htaccess in webroot this:
<KBrogan> RedirectMatch 404 "^/Symfony(/.*)?$"
<KBrogan> RedirectMatch 404 "/\..*"
<KBrogan> RedirectMatch 404 "/(config||app(_dev)?).php"
<KBrogan> <IfModule mod_rewrite.c>
<KBrogan>     RewriteEngine On
<KBrogan>     RewriteCond %{REQUEST_FILENAME} !-f
<KBrogan>     RewriteRule ^(.*)$ index.php [QSA,L]
<KBrogan> </IfModule>
<KBrogan> last step - make a symlink index.php => app_dev.php
<bernardnapoleon> ohhhhhhhhhhhhhhhhhhhhhhhhhh...................
<KBrogan> Do you have shell access on your host bernard?
<bernardnapoleon> nope
<helios_ag> not good idea to publish dev env on prod env
<bernardnapoleon> helios_ag: yep yep. 
<KBrogan> dev env ip blacklists itself. Not really an issue until you've deployed
<bernardnapoleon> KBrogan: Thank you! 
<bernardnapoleon> i'll just rename app.php to index.php incase i can't do symlink
<KBrogan> if you don' t have shell access: either make a link with php, or rename the app.php
<bernardnapoleon> yeah. Thanks Again Bro
<bernardnapoleon> =)
<bernardnapoleon> all this time I thought the answer is in mod_rewrite
<KBrogan> i'm quite happy with the results there. Spent a couple of hours tweaking it
<KBrogan> I've got shell access, so I set up an alias dev and an alias prod which switches the environment for me and clears the cache
<KBrogan> Question: is there a twif filter which pretty prints all your html?
<KBrogan> twig*
<bernardnapoleon> oh cool. 
<bernardnapoleon> not an expert but I think you have to post process that. 
<KBrogan> by the way bernard, the RedirectMatch 404 "/\..*" bit will hide all of your .htaccess files and make them return 404 instead of 403
<KBrogan> as well as any other file that stats with .
<KBrogan> and any other file besides /Symfony/* , index.php, app_dev.php, app.php, will be served directly by Apache
<bernardnapoleon> ohhhh