.htaccess URL重写不起作用

时间:2011-02-28 15:38:10

标签: http iis .htaccess mod-rewrite isapi-rewrite

为什么这个脚本不能用于/ Project Profiles?

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.79

RewriteEngine on
RewriteCond $1 !(cp|img|files|js|css|index\.php|x|flat|robots\.txt|file\.html|uploadfile\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

日志:

147240/initial] (2) init rewrite engine with requested uri /x/email2image.php?prefix=sales
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^(.*)$' to uri '/x/email2image.php'
(4) RewriteCond: input='/x/email2image.php' pattern='(favicon.ico|cp|img|files|js|css|index\.php|x|flat|robots\.txt|file\.html|uploadfile\.php)' => not-matched

---------- WHY DOESNT THIS WORK?? --------------------------
(2) init rewrite engine with requested uri /ProjectProfiles
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^(.*)$' to uri '/ProjectProfiles'
(4) RewriteCond: input='/ProjectProfiles' pattern='(favicon.ico|cp|img|files|js|css|index\.php|x|flat|robots\.txt|file\.html|uploadfile\.php)' => not-matched
------------------------------------------------------------

(2) init rewrite engine with requested uri /ContactUs
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^(.*)$' to uri '/ContactUs'
(4) RewriteCond: input='/ContactUs' pattern='(favicon.ico|cp|img|files|js|css|index\.php|x|flat|robots\.txt|file\.html|uploadfile\.php)' => matched
(1) Rewrite URL to >> /index.php//ContactUs
(2) rewrite '/ContactUs' -> '/index.php//ContactUs'
(2) internal redirect with /index.php//ContactUs [INTERNAL REDIRECT]

1 个答案:

答案 0 :(得分:1)

因为ProjectProfiles包含“files”。根据您打算如何使用其他匹配项,请尝试例如

RewriteCond $1 !^/(cp|img|files|js|css|index\.php|x|flat|robots\.txt|file\.html|uploadfile\.php)$