2016-02-12 45 views
0

我想我在这里有一个很好的。RewriteCond/RewreiteRule

尝试在.htaccess文件中写入重写。

如果传入的URL有?p =其中我需要重写为index.php。如果传入的域名只有www.myurl.com,我需要它重写为home.php

这甚至可能吗?

谢谢。

回答

0

尝试:

RewriteEngine on 

#--If the incoming url has "?p="--# 
RewriteCond %{QUERY_STRING} p=.* [NC] 
#--Then redirect to /index.php--# 
RewriteRule^/index.php? [NC,L,R] 
#--Else, redirect to home.php--# 
RewriteRule ^$ /home.php [NC,L,R]