mod-rewrite,htaccess和pass through

时间:2012-12-03 04:34:32

标签: .htaccess mod-rewrite

我有一个.htaccess问题,正在慢慢破坏我的理智。在我的项目中,我有一个包含404.php的根文件夹,以及一个名为注册的显式子目录。该子目录包含一个名为 index.php 的文件,用于执行处理。该项目在Windows 7下使用XAMPP。

根.htaccess文件包含以下内容:

Options +FollowSymlinks

RewriteEngine On

ErrorDocument 404 /404.php

注册物理子目录中的.htaccess包含:

RewriteEngine On
RewriteOptions inherit

Options +FollowSymlinks
RewriteCond %{REQUEST_URI} ^/signup/page1$ [NC]
RewriteRule (.*) signup/index.php?page=1 [NC,L]

下面的重写日志似乎决定在重写模块甚至可以检查之前 / signup / page1 不存在。有没有人对可能导致此问题的原因有任何想法?

10.1.1.201 - - [03/Dec/2012:15:06:58 +1100] [testsite.com/sid#463bd0][rid#4412b10/initial] (1) [perdir C:/workspace/project/public/signup/] pass through C:/workspace/project/public/signup/page1
10.1.1.201 - - [03/Dec/2012:15:06:58 +1100] [testsite.com/sid#463bd0][rid#4500fc0/initial/redir#1] (3) [perdir C:/workspace/project/public/] strip per-dir prefix: C:/workspace/project/public/404.php -> 404.php
10.1.1.201 - - [03/Dec/2012:15:06:58 +1100] [testsite.com/sid#463bd0][rid#4500fc0/initial/redir#1] (3) [perdir C:/workspace/project/public/] applying pattern '(.*)' to uri '404.php'

2 个答案:

答案 0 :(得分:1)

您必须在RewriteBase目录的.htaccess中使用signup这样的内容:

RewriteEngine On
RewriteOptions inherit
Options +FollowSymlinks

RewriteBase /signup

RewriteRule ^page1$ /signup/index.php?page=1 [NC,L,QSA]

答案 1 :(得分:0)

试试这个:

RewriteEngine On
RewriteRule ^signup/page1/?$  http://mydomain.com/signup/index.php?page=1 [L]