我在服务器上使用以下htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php
RewriteRule ^[^/]*\.html$ index.php
RewriteRule ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/ - [L]
RewriteRule ^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)/.*$ - [L]
现在他们让我在他们的服务器中准备一个静态页面,让我们称之为http://www.myserver.com/mystaticpage.html
问题是,当我尝试访问该URL时,它会重定向到index.php。我怎么能改变htacces文件来解决这个问题,而不会搞乱已安装的CMS?
答案 0 :(得分:1)
试试这个:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond ${REQUEST_URI} !^/(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads|showpic\.php)
RewriteRule .* index.php
.*
重写为index.php,那么为什么还要重写^[^/]*\.html$ index.php
呢?它已经匹配了以前的规则... RewriteCond
条件仅适用于第一条规则。因此第二条规则也适用于磁盘上的静态文件。RewriteCond
,因为它们只是试图避免重写某些uris