Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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
Symfony1 symfony中我的生产服务器的配置问题_Symfony1_Config_Production - Fatal编程技术网

Symfony1 symfony中我的生产服务器的配置问题

Symfony1 symfony中我的生产服务器的配置问题,symfony1,config,production,Symfony1,Config,Production,嗯,我有一个共享主机,我没有ssh访问权限。问题是服务器结构和symfony结构 服务器具有此结构 错误/ 日志/ ... 网/ 在web目录中,我们可以加载web应用程序。。。 symnfony结构是 应用程序/ .. 网/ 问题是,对于我的域名,如果我试图访问,我必须将www.domainname.com/web/放到symfony项目的acces中 1) 如果我尝试将所有web symfony内容复制到web目录,它会呈现第一页ok(index.php),但链接错误,因为它们是www.do

嗯,我有一个共享主机,我没有ssh访问权限。问题是服务器结构和symfony结构

服务器具有此结构

错误/ 日志/ ... 网/

在web目录中,我们可以加载web应用程序。。。 symnfony结构是

应用程序/ .. 网/

问题是,对于我的域名,如果我试图访问,我必须将www.domainname.com/web/放到symfony项目的acces中

1) 如果我尝试将所有web symfony内容复制到web目录,它会呈现第一页ok(index.php),但链接错误,因为它们是www.domainame.com/moduleName/,而此目录不存在

2) 如果我在web域目录中创建.htacces文件。。。当我放置www.domainname.com时,它会将我重定向到web automatic,但其他链接的方向是www.domainname.com/web/moduleName/

我只想要www.domainname.com/moduleName/。。。我怎么能做到

这很紧急

谢谢

edit1。这是我的.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 ^(.*)$ web/index.php [QSA,L]
</IfModule>
如果我修改这个,我将无法访问我的/blog/dir? 谢谢

.htaccess mod_rewrite

.htaccess
mod_rewrite

为了从url中删除/web,您需要使用名为mod_rewrite的apache模块。像这样:

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>
Options+FollowSymLinks+ExecCGI
重新启动发动机
#如果遇到问题,请取消对以下行的注释
#无法使用脚本名称
#重写基/
#我们跳过了所有的文件
#重写条件%{REQUEST_URI}\+$
#重写条件%{REQUEST\u URI}!\。html$
#重写规则。*-[L]
#我们检查.html版本是否在这里(缓存)
重写规则^$index.html[QSA]
重写规则^([^.]+)$$1.html[QSA]
重写cond%{REQUEST_FILENAME}-F
#不,所以我们重定向到前端web控制器
重写规则^(.*)$index.php[QSA,L]
这方面的文件是


设置symfony的正确方法是使用指向web文件夹的虚拟主机。这将使用web文件夹作为根目录,因此您不会在url中看到它。

为了从url中删除/web,您需要使用名为mod_rewrite的apache模块。像这样:

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>
Options+FollowSymLinks+ExecCGI
重新启动发动机
#如果遇到问题,请取消对以下行的注释
#无法使用脚本名称
#重写基/
#我们跳过了所有的文件
#重写条件%{REQUEST_URI}\+$
#重写条件%{REQUEST\u URI}!\。html$
#重写规则。*-[L]
#我们检查.html版本是否在这里(缓存)
重写规则^$index.html[QSA]
重写规则^([^.]+)$$1.html[QSA]
重写cond%{REQUEST_FILENAME}-F
#不,所以我们重定向到前端web控制器
重写规则^(.*)$index.php[QSA,L]
这方面的文件是


设置symfony的正确方法是使用指向web文件夹的虚拟主机。这将使用web文件夹作为您的根目录,因此您不会在url中看到它。

peter它工作不正常,因为它将我重定向到web服务器模块。。在我的.htacces文件(我编辑了文章)中,你可以看到什么对我有用。。。但只有当我把www.domain.com的其他链接。。。www.domain.com/web/module,我想删除/web/i尝试$this->setWebDir($this->getRootDir()./web');和你粘贴的代码,但它不起作用。。。我已经编辑了我的答案。谢谢,最后我将web(symfony)内容复制到web(服务器)。更改projectconfiguration路由,它可以与RewriteRule^(.*)$index.php[QSA,L]一起工作。谢谢。peter它工作不好,因为它将我重定向到web服务器模块。。在我的.htacces文件(我编辑了文章)中,你可以看到什么对我有用。。。但只有当我把www.domain.com的其他链接。。。www.domain.com/web/module,我想删除/web/i尝试$this->setWebDir($this->getRootDir()./web');和你粘贴的代码,但它不起作用。。。我已经编辑了我的答案。谢谢,最后我将web(symfony)内容复制到web(服务器)。更改projectconfiguration路由,它与RewriteRule^(.*)$index.php[QSA,L]配合良好,谢谢。。。我编辑了我的帖子,向您展示了我的.htaccess文件。。我要修改什么?davidosomething。。。我编辑了我的帖子,向您展示了我的.htaccess文件。。我要修改什么