1

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

服务器具有这种结构

错误/日志/ ...网络/

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

应用程序/ .. 网络/

好吧,问题在于我的域,如果我尝试访问,我必须将 www.domainname.com/web/ 放入 symfony 项目的访问权限中......

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

2)如果我在 web 域目录中创建一个 .htacces 文件......当我把 www.domainname.com 它重定向到 web 自动但其他链接有 www.domainname.com/web/moduleName/ 在他的方向

我只想要 www.domainname.com/moduleName/... 我该怎么做???

迫在眉睫。

谢谢。

编辑1。这是我的 .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>

编辑2。另一个相关的问题

..
/web/
   app/
   ...
   web/
/blog/

如果我修改它,我将无法访问我的 /blog/ 目录?谢谢

4

2 回答 2

1

.htaccess mod_rewrite

于 2010-01-28T18:03:40.527 回答
0

为了从 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>

文档在这里

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

于 2010-01-28T18:12:33.977 回答