0

我想通过使用 .htaccess 文件排除一页来重定向同一页面上的请求。我用过的代码

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

有人知道我如何在名为“register.php”的单个页面上获取条件吗?意味着我现在要打开 register.php,它的打开 index.php。

提前致谢

4

2 回答 2

0
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(index\.php|register\.php)$
RewriteRule ^(.*)$ index.php? [L,R=301,E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
于 2013-05-24T12:44:03.940 回答
0

将您的代码更改为:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(index|register)\.php$ [NC]
RewriteRule ^(.+?\.(php|html?|feed|pdf|raw)|[^.]*)$ index.php [L,NC]

RewriteCond %{ENV:REDIRECT_STATUS} !200
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
于 2013-05-24T12:47:46.020 回答