mod rewrite-如何绕过父目录中的.htaccess



我的问题与:没有Vhost配置的Zend Framework 2相同,但该解决方案没有解决我的问题。

我得到了一个定制的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/<Zend应用程序在此>(其他问题的解决方案(。

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添加了大量内容,这在一定程度上改变了情况。假设您能够编辑htaccess,最简单的方法就是将ZF规则移到其中。只需更改任何包含public的行,并在其前面添加c-booking。因此,例如,最后一行看起来像:

RewriteRule ^c-booking/public/.*$ /c-booking/public/index.php [NC,L]

还要注意,这是一种不太安全的托管应用程序的方式。如果你有任何非PHP配置文件、缓存文件等(通常在web根目录之外(,请确保它们不能通过浏览器查看。

最新更新