johnmccc Posted February 17, 2010 Share Posted February 17, 2010 Hi, I want to change the url with PHP, if this is possible (Let's suppose we don't have to watch if we are in a folder or not) For example my current url is: http://www.domain.com/php And I want to change it with PHP into: http://www.domain.com/php/ On a very simple way the PHP would look like this (but oufcourse it will not work): $_SERVER = $_SERVER + "/"; Link to comment https://forums.phpfreaks.com/topic/192446-changen-url-with-php/ Share on other sites More sharing options...
thunder708 Posted February 17, 2010 Share Posted February 17, 2010 $_SERVER['SERVER_NAME'] = $_SERVER['SERVER_NAME']."/"; Try that my two previous attempts didnt work, if you saw it. it should but you could just have it as: $server = $_SERVER['SERVER_NAME']."/"; just to save typing time Link to comment https://forums.phpfreaks.com/topic/192446-changen-url-with-php/#findComment-1014034 Share on other sites More sharing options...
johnmccc Posted February 17, 2010 Author Share Posted February 17, 2010 try $_SERVER = $_SERVER."/" I was just giving an example of how it should look like, but the syntax will be definitely wrong Link to comment https://forums.phpfreaks.com/topic/192446-changen-url-with-php/#findComment-1014036 Share on other sites More sharing options...
thunder708 Posted February 17, 2010 Share Posted February 17, 2010 just look at my last post ive edited it and tested it out on my own website and it works and btw either way that i have suggested works Link to comment https://forums.phpfreaks.com/topic/192446-changen-url-with-php/#findComment-1014040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.