【问题标题】:.htaccess URL rewrite not working.htaccess URL 重写不起作用
【发布时间】:2011-07-05 20:50:32
【问题描述】:

为什么此脚本不适用于 /ProjectProfiles?

# 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]

【问题讨论】:

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


    【解决方案1】:

    因为 ProjectProfiles 包含“文件”。根据您打算如何进行其他比赛,尝试例如

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

    【讨论】:

    • 它回答了这个问题。正如他的模式所示,他知道如何使用 ^ 和 $ 并且可以轻松修复 RewriteCond。但是,我将在 RewriteCond 中进行编辑。
    • 他的日志表明 $1 包含 /
    • 是的,我刚刚看到了。 (在 Apache .htaccess 中不会。)
    • 实际上我不久前继承了这个配置,只是根据需要添加了 dir,我对这些不太感兴趣,谁能告诉我如何制作特定的“文件”,即。 "/files/" 这样它就不会在 projectproFiles 中被拾取 - 谢谢
    • 只需在 RewriteCond 中使用 |/files|
    猜你喜欢
    • 2015-02-03
    • 2014-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多