2016-02-12 43 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]