Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
11-16-2011, 11:51 AM #1
manipulating segments of current url
Hope you can help. How do you simply output the current url in the browser i.e if i am in google.com I want google.com outputted and so on.
Also on multilanguage sites if my url is say www.mydomain.com/en/about.html or http://www.mydomain.com/en/animals/h...stallions.html I want to be able to manipulate the url so I can change en to fr for example when I jump between english and french pages. I want users to be able to switch the language of that particular page by clicking a link. I need to be able to switch segment one of the url (en,fr,de etc...)dynamically somehow instead of hardcoding a link into each page.
11-16-2011, 01:53 PM #2
- Join Date
- Sep 2010
- The Twilight Zone
- Thanked 2 Times in 2 Posts
To output the current URL in the browser
//HTTP_HOST is the base url(basically the url that made the request //PHP_SELF is the path of the file of the page you're at relative to the doc root. //Combined, this gives you the absolute path to a file echo $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; //Browser redirect (which is what I'm assuming you're looking for) header('Location: '. 'Path to your file here');