.htaccess允许我在子目录中查看php和html文件

时间:2014-06-11 20:04:07

标签: php .htaccess

我正在尝试将moodle安装到网站的子目录中。然而,那里已经有一个家庭酿造CMS,而.htaccess正在给我带来麻烦。我如何更改下面的文件以在子目录/ moodle /中获得正常的网站结果,以便以预期的方式显示诸如/moodle/test.php或/moodle/test.html之类的页面?

php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST}                ^([^:]+)
RewriteRule ^assets/documents/([0-9]+)/?.*$    /home/user/htdocs/scripts/document.scr.php?id=$1 [NC,L]

RewriteRule ^logout/.*$    /home/user/htdocs/scripts/logout.scr.php?id=$1 [NC,L]

RewriteRule ^assets/.*$ -   [L]
RewriteRule ^cms/.*$        -   [L]
RewriteRule ^uploads/.*$    -   [L]
RewriteRule ^scripts/.*$    -   [L]
RewriteRule ^phpMyAdmin/.*$ -   [L]

RewriteRule ^.*$        index.php [L]

1 个答案:

答案 0 :(得分:1)

排除moodle/

RewriteCond %{REQUEST_URI} !^moodle/
RewriteRule ^.*$ index.php [L]

所有其他内容将由CMS'处理。切入点index.php