0

我对本地机器上的 reqrite 规则发疯了……

我什至启用了重写日志,这是我从应该重写的 url 上的单个页面加载中得到的:

ip - - [21/May/2013:08:13:18 +0200] [scxx/sid#7f6580ce32b8][rid#7f65810069e0/initial] (2) init rewrite engine with requested uri /catdev/sc/eprocure/ajax/ArticleSearch/SearchEngine/GetInitialData
ip - - [21/May/2013:08:13:18 +0200] [scxx/sid#7f6580ce32b8][rid#7f65810069e0/initial] (3) applying pattern '^/catdev/sc/eprocure/ajax/(.+)/(\w+)/(\w+?)$' to uri '/catdev/sc/eprocure/ajax/ArticleSearch/SearchEng$
ip - - [21/May/2013:08:13:18 +0200] [scxx/sid#7f6580ce32b8][rid#7f65810069e0/initial] (2) rewrite '/catdev/sc/eprocure/ajax/ArticleSearch/SearchEngine/GetInitialData' -> '/catdev/sc/eprocure/ajax/handler.php?pa$
ip - - [21/May/2013:08:13:18 +0200] [scxx/sid#7f6580ce32b8][rid#7f65810069e0/initial] (3) split uri=/catdev/sc/eprocure/ajax/handler.php?path=ArticleSearch&class=SearchEngine&method=GetInitialData -> uri=/catde$
ip - - [21/May/2013:08:13:18 +0200] [scxx/sid#7f6580ce32b8][rid#7f65810069e0/initial] (2) local path result: /catdev/sc/eprocure/ajax/handler.php
ip - - [21/May/2013:08:13:18 +0200] [scxx/sid#7f6580ce32b8][rid#7f65810069e0/initial] (1) go-ahead with /catdev/sc/eprocure/ajax/handler.php [OK]

该路径被正确找到,但它仍然没有加载它应该加载的页面。我不知道为什么!

错误日志向我显示了这一点。

[Tue May 21 08:13:18 2013] [error] [client xxx.xxx.xxx.xx] File does not exist: /catdev/sc/eprocure

现在我在我的 apache 配置中有这些重写规则:

<VirtualHost *:80>
        ServerAdmin webmaster@xxx.at
        ServerName xxx
        DocumentRoot /data1/www/somewherefarbeyond/ssl-htdocs

        <Directory /data1/www/somewherefarbeyond/ssl-htdocs/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /data1/www/somewherefarbeyond/logs/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /data1/www/somewherefarbeyond/logs/access.log combined


        RewriteEngine On
         RewriteRule ^/catdev/sc/eprocure/ajax/(.+)/(\w+)/(\w+?)$      /catdev/sc/eprocure/ajax/handler.php?path=$1&class=$2&method=$3 [L]
        RewriteLog /data1/www/somewherefarbeyond/logs/accessREWRITE.log
        RewriteLogLevel 9

</VirtualHost>

somone 可以在这件事上解释一下吗?

我正在尝试的网址是 xxx/catdev/sc/eprocure/ajax/ArticleSearch/SearchEngine/GetInitialData

注意 xxx 是来自我的开发服务器的手动 owerwriten 域,并且 ips 被隐藏了。

4

1 回答 1

0

他妈的。

Iw 是一个 debian“功能”

我在一个 debian 发行版上工作,由于某些奇怪的原因,当您在基本配置中进行重写时,您必须指定整个 DIRECTORY 路径而不是相对路径。

只需将重写的 url 设为目录位置而不是 url!

例子是:

你的 www 文件夹在

/motherofGod/wtf/www

您的 www root/motherofGod/wtf/www在补丁中设置为

你的域名是lols.com

所以文件lols.com/lol/wtf

这需要到/motherofGod/wtf/www/some/crap/handler.php

您必须指定整个路径,而不仅仅是 www 目录的相对路径 ~_~

于 2013-05-21T15:12:15.973 回答