2011-02-28 178 views
0

爲什麼此腳本不適用於/ ProjectProfiles?.htaccess URL重寫不起作用

# 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

因爲ProjectProfiles包含 「文件」。根據您希望其他匹配的工作方式,請嘗試

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

這是正確的,但沒有幫助。 – aaz 2011-02-28 15:48:09

+0

它回答了這個問題。正如他的模式顯示的那樣,他知道如何使用^和$,並且可以輕鬆修復RewriteCond。但是,我將在RewriteCond中進行編輯。 – Erik 2011-02-28 15:49:54

+0

他的日誌表示$ 1包含/ – Erik 2011-02-28 15:58:55