blacktiger786 Posted July 31, 2014 Share Posted July 31, 2014 (edited) i want create some code i don't know what i do can you help me if i have domain like http://www.domain.com www.domain.com i want run code which remove www from this domain this not for one domain i want when any domain come with www its remove www and show without www like http://domain.com and if any domain come without www it let it what i do please help me? Edited July 31, 2014 by blacktiger786 Quote Link to comment https://forums.phpfreaks.com/topic/290205-need-help-of-www-to-non-www-in-php/ Share on other sites More sharing options...
cyberRobot Posted July 31, 2014 Share Posted July 31, 2014 (edited) Just to clarify, are you trying to redirect visitors who go to "www.domain.com" to "domain.com"? Or are you just looking to manipulate a string? For what it's worth, PHP has a built-in function for parsing URLs: http://php.net/manual/en/function.parse-url.php You could also look at replacing the "www." part using str_replace(). Just be aware that this will replace all occurrences of "www." http://php.net/manual/en/function.str-replace.php Edited July 31, 2014 by cyberRobot Quote Link to comment https://forums.phpfreaks.com/topic/290205-need-help-of-www-to-non-www-in-php/#findComment-1486540 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.