.htaccess用短url重写(重定向程序)



我有一个关于的问题

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^(.*)$ $1.php

我的想法:

http://redir.com/? to execute redir.php
http://redir.com or http://redir.com/ to execute index.php

如何进行htaccess?

tnx

以下重写规则将重写http://redir.com?blah到http://redir.com/test.php.

这意味着http://redir.com/test.php将执行而不是正常http://redir.com/index.php访问时http://redir.com但如果设置了查询字符串CCD_ 1,则

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} ^blah$
RewriteRule ^index.php$ test.php [L,NC,QSA]
</IfModule>

最新更新