【发布时间】:2014-06-15 21:57:11
【问题描述】:
我的问题与:Zend Framework 2 without Vhost configuration 相同,但解决方案没有解决我的问题。
我得到一个自定义的 404 页面。
我的项目位于子目录中,我相信父目录中的 .htaccess 正在阻止它工作。
注意:我无法删除那个,因为那里正在运行另一个项目
htdocs/.htaccess:
Options -Indexes
Options +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RewriteRule ^transcripts/$ https://spreadsheets.google.com/a/ci4tcm.com/ccc? key=0AodnCB9Mr1K1dFFmbGhOc3V4RjBvNzZxSE9EZ1dtSnc&hl=en#gid=0 [R,NC]
# ErrorDocument 404 /pages/404.html
# ErrorDocument 500 /pages/404.html
# ErrorDocument 403 /pages/404.html
# RewriteRule ^css(/)?$ / [R]
# RewriteRule ^download/([A-Za-z0-9.]*)/([A-Za-z0-9.]*)$ /download/$1/$2/ [R]
# RewriteRule ^download/([A-Za-z0-9.]*)/([A-Za-z0-9.]*)/$ /download.php?test=$2&fol=$1
RewriteRule ^download/([A-Za-z0-9.]*)$ /download/$1/ [R]
RewriteRule ^download/([A-Za-z0-9\+.-\s]*)/([A-Za-z0-9\+.-\s]*)$ /download.php?folder=$1&file=$2 [L]
RewriteRule ^download/([A-Za-z0-9.]*)$ /posters/$1/ [R]
RewriteRule ^download/([A-Za-z0-9\+.-\s]*)$ /images/wellbeing_posters/pdfs/$1 [L]
AddHandler server-parsed html
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^(.*)$ "http\:\/\/www\.another-domain\.com\/$1" [R=301,L]
# A bunch of redirect 303's here
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
htdocs/booking/ (其他问题的解决方案)。
RewriteEngine On
RewriteRule ^\.htaccess$ - [F]
RewriteCond %{REQUEST_URI} = ""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
所以我的问题是,当用户想要使用 Zend 应用程序进入物理子目录时,我如何绕过父目录 .htaccess 规则?
【问题讨论】:
-
另一个问题的链接不正确。它指向“询问”页面。
-
是什么不工作?父文件夹 .htaccess 规则只是在 URL 中强制执行
www,它们不会对您的 ZF 项目中的规则造成任何问题。 -
@Ruben 我更新了链接
-
@TimFountain 我不允许配置虚拟目录。链接中的答案对我不起作用,所以我认为可能是另一个 htaccess 导致它。尝试访问我的 ZF 应用程序时,我收到了一个自定义的 404 未找到页面。
-
ZF 404 页面?如果是这样,则更有可能是路由问题。
标签: .htaccess mod-rewrite zend-framework2 virtualhost