相关疑难解决方法(0)

RewriteRule Last [L]标志不起作用?

php_flag display_errors 1
php_value auto_prepend_file init.php
RewriteEngine on 
RewriteRule ^$  /id/authenticate [R]
RewriteRule ^login_openid$  /id/login_openid.php [QSA,L]
RewriteRule ^authenticate$  /id/authenticate.php [QSA,L]
RewriteRule ^facebook$  /id/facebook.php [QSA,L]
RewriteRule ^createfromopenid$  /id/createfromopenid.php [QSA,L]

RewriteRule .* - [L,R=403]
Run Code Online (Sandbox Code Playgroud)

这是我的.htaccess文件.在我刚刚拥有的serverconfig中AllowOVerride all.

如果我请求URL,http://mydomain.com/id/authenticate我会收到403错误.如果我删除最后一条规则,它就可以了.[L]公寓不应该阻止任何进一步的规则发生吗?

编辑:

我的htaccess文件位于子文件夹"id"中,因此规则有效.

apache mod-rewrite http url-rewriting

27
推荐指数
2
解决办法
4万
查看次数

Mod_Rewrite意外行为L标志

我的Web应用程序结构是:

/var/www/myapp/
    - www/
        - index.php
        - css.php
        - .htaccess
Run Code Online (Sandbox Code Playgroud)

虚拟主机配置为:

<VirtualHost *:80>
        ServerName www.example.org
        DocumentRoot /var/www/myapp/www
        DirectoryIndex index.php index.html
        <Directory /var/www/myapp/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

在/var/www/myapp/www/.htaccess中有:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /
    RewriteRule css css.php [L,NC]
    RewriteRule .* index.php
</IfModule>
Run Code Online (Sandbox Code Playgroud)

现在,如果我打电话给www.example.org,我正确地重定向到index.php,但是如果我打电话给www.example.org/css,我仍然会被重定向到index.php.

如果我删除"RewriteRule.*index.php"行,然后调用www.example.org/css,我正确地重定向到css.php.

怎么了?非常感谢

========编辑=========

192.168.1.8 - - [14/Jul/2012:19:07:21 +0200] [www.example.org/sid#b747b6c0][rid#b7080058/initial] (3) [perdir /var/www/sviluppo/mattia_dev/example/www/] add path info postfix: /var/www/sviluppo/mattia_dev/example/www/DEV_2 -> /var/www/sviluppo/mattia_dev/example/www/DEV_2/css/example1/test.css
192.168.1.8 - - [14/Jul/2012:19:07:21 +0200] [www.example.org/sid#b747b6c0][rid#b7080058/initial] (3) [perdir /var/www/sviluppo/mattia_dev/example/www/] strip …
Run Code Online (Sandbox Code Playgroud)

apache mod-rewrite

9
推荐指数
1
解决办法
7355
查看次数

标签 统计

apache ×2

mod-rewrite ×2

http ×1

url-rewriting ×1