Remove 'web' from Symfony 1.4 path on shared hosting?

可紊 提交于 2019-12-25 05:47:08

问题


I've found a lot of helpful information about installing Symfony 1.4 on a shared hosting plan, but I've run into a stumbling block that's confounded me all day.

Going to http://www.alternium.net/jobeet/index.php returns a 404 instead of the file at http://www.alternium.net/jobeet/web/index.php.

/jobeet/.htaccess:

Options +FollowSymLinks +ExecCGI

# Enable rewrite engine and route requests to framework
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^/robots.txt
RewriteRule ^(.*)$ /jobeet/web/robots.txt [L]

# resources
RewriteCond %{REQUEST_URI} ^/images/  [OR]
RewriteCond %{REQUEST_URI} ^/js/      [OR]
RewriteCond %{REQUEST_URI} ^/fonts/   [OR]
RewriteCond %{REQUEST_URI} ^/css/     
RewriteRule ^(.*)$ /jobeet/web/$1 [L]

RewriteCond %{REQUEST_URI} !^/jobeet/web/
RewriteCond %{REQUEST_URI} !^/frontend_dev.php
RewriteRule ^(.*)$ /jobeet/web/index.php/$1 [QSA,L]

RewriteCond %{REQUEST_URI} frontend_dev.php
RewriteRule ^$ /jobeet/web/$1 [QSA,L]

/jobeet/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]

  RewriteCond %{REQUEST_URI} \..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteCond %{REQUEST_URI} !\.php
  #RewriteCond %{REQUEST_URI} !\.php
  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>

Can anyone with a better understanding than I of Symfony or rewrite rules tell me where I'm going wrong?


回答1:


If you have a private folder on your shared host (like on plesk hosts) you can put all your symfony folders (expect web/) in your private folder. Then you have to adjust your web dir in the symfony configs and the path to your ProjectConfiguration in your front controller (index.php or frontend_dev.php, ...).



来源:https://stackoverflow.com/questions/7073121/remove-web-from-symfony-1-4-path-on-shared-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!