Get the full URL in PHP

This question’s answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions. I use this code to get the full URL: $actual_link = ‘http://’.$_SERVER[‘HTTP_HOST’].$_SERVER[‘PHP_SELF’]; The problem is that I use some masks in my .htaccess, so what we see in the URL is not … Read more

React-router urls don’t work when refreshing or writing manually

I’m using React-router and it works fine while I’m clicking on link buttons, but when I refresh my webpage it does not load what I want. For instance, I am in localhost/joblist and everything is fine because I arrived here pressing a link. But If I refresh the webpage I get: Cannot GET /joblist By … Read more

How can I open a URL in Android’s web browser from my application?

How to open an URL from code in the built-in web browser rather than within my application? I tried this: try { Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link)); startActivity(myIntent); } catch (ActivityNotFoundException e) { Toast.makeText(this, “No application can handle this request.” + ” Please install a webbrowser”, Toast.LENGTH_LONG).show(); e.printStackTrace(); } but I got an Exception: … Read more

Get the values from the “GET” parameters (JavaScript) [duplicate]

This question already has answers here: How can I get query string values in JavaScript? (73 answers) Closed 4 months ago. I have a URL with some GET parameters as follows: www.test.com/t.html?a=1&b=3&c=m2-m3-m4-m5 I need to get the whole value of c. I tried to read the URL, but I got only m2. How do I … Read more

Encode URL in JavaScript?

How do you safely encode a URL using JavaScript such that it can be put into a GET string? var myUrl = “http://example.com/index.html?param=1&anotherParam=2”; var myOtherUrl = “http://example.com/index.html?url=” + myUrl; I assume that you need to encode the myUrl variable on that second line? 2 21 Check out the built-in function encodeURIComponent(str) and encodeURI(str). In your … Read more