-1
我目前工作的公司有一个基于symfony 2.8的3年以上的现场网站。最近它被部署用于测试新客户。原始图像通过html访问,如“/bundles/bundlename/images/image.png”。为什么没有这个重写过程?
然而,在客户服务器上,整个事情都在一个子文件夹下,所以image url应该像“/d2s/bundles/bundlename/images/image.png”。 我们有这样的项目的web目录.htaccess文件:
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
FollowSymLinks On
RewriteRule /?bundles/(.*)$ /d2s/bundles/$1 [NC,R=301,L]
# Determine the RewriteBase automatically and set it as environment variable.
# If you are using Apache aliases to do mass virtual hosting or installed the
# project in a subdirectory, the base path will be prepended to allow proper
# resolution of the app.php file and to redirect to the correct URI. It will
# work in environments without path prefix as well, providing a safe, one-size
# fits all solution. But as you do not need it in this case, you can comment
# the following 2 lines to eliminate the overhead.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
[,,,]
所有其它部件做工精细,在阿帕奇的conf的虚拟主机的AllowOverride设置为所有。但是,这个URL重写不起作用,就像它根本不存在一样。
任何想法可能是错误的?
我刚刚意识到我提出了一个概念错误。由于整个应用程序位于子文件夹(/ d2s /)中,因此对/ bundles /的调用永远不会到达应用程序的文档根目录,因此也不会到达.htaccess。无论我把它放在它不会这样工作.. 如果版主读这个请求关闭这个问题! – posthy