我希望通过使用.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。
提前致谢
答案 0 :(得分: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}]
答案 1 :(得分: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]