Htaccess:RewriteCond不适用于多种条件

时间:2016-08-29 19:33:29

标签: regex .htaccess

我需要用户发送此Url格式:

localhost/application/form.php

重定向并传递'form.php'作为参数:

localhost/application/index.php/site/integration/form.php

要将其他网址格式重定向到:

localhost/application/index.php

我提出了这段代码,但不起作用:

<IfModule mod_rewrite.c>
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} !.*.php
RewriteRule .*.php index.php/site/integracao - [L]

RewriteBase /
RewriteRule . index.php - [L]

</IfModule>

1 个答案:

答案 0 :(得分:0)

application/.htaccess内,您可以使用此规则:

RewriteEngine on

RewriteRule ^[\w-]+\.php$ index.php/site/integration/$0 [L,NC]