将URL中的www替换为模式(通配符子域)



有办法取代吗

www.domain.com/new-mexico/albuquerque/businessname-513526.html

这个:

businessname.domain.com/new-mexico/albuquer/businessname-513526.html

意思是";www";将替换为企业名称。这应该很简单,但我不知道如何做到这一点。

听起来像是使用str_replace

$old_domain = "www.domain.com/new-mexico/albuquerque/businessname-513526.html";
$new_domain = str_replace("www.", "businessname.", $old_domain); //I chose to add the dot along with the www just in case there was another www in the url

最新更新