How to get domain root url in Laravel 4?

UPDATE (2017-07-12) A better solution is actually to use Request::getHost() Previous answer: I just checked and Request::root(); does return http://www.example.com in my case, no matter which route I’m on. You can then do the following to strip off the http:// part: if (starts_with(Request::root(), ‘http://’)) { $domain = substr (Request::root(), 7); // $domain is now ‘www.example.com’ … Read more

Is a UUID “URL safe”?

Yes. A UUID consists of only hexadecimal characters (a–f, 0–9) plus a hyphen (-). As per RFC 3986 (URI Syntax) §2.3, hyphen and hexadecimal characters are included in those explicitly unreserved: Characters that are allowed in a URI but do not have a reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal … Read more

Laravel generate secure https URL from route

UPDATE: As pointed out in the comments, a simpler way of doing this would be adding URL::forceSchema(‘https’); for Laravel version between 4.2-5.3 or URL::forceScheme(‘https’); for version 5.4+ in the boot method of your AppServiceProvider file. Old answer: It’s actually entirely possible and there’s only one line of code needed to accomplish that. Laravel doesn’t check … Read more

Can an URL shortener pass parameters?

There’s no technical reason why it couldn’t be done. The service would simply have to look at what parameters it is being sent, and then rewrite the target URL accordingly. The problem is that it’s not necessarily well defined how to do that. Suppose you have the url http://example.com/default.aspx?foo=bar, and it has the short url … Read more

DELETE using CURL with encoded URL

Since you are in a bash environment, you could encode the hash OXYugGKg207g5uN/07V before passing it to curl. A straight-forward approach would be to use its byte representation %4f%58%59%75%67%47%4b%67%32%30%37%67%35%75%4e%2f%30%37%56 To get that, call: echo -ne “OXYugGKg207g5uN/07V” | xxd -plain | tr -d ‘\n’ | sed ‘s/\(..\)/%\1/g’ It will give you: %4f%58%59%75%67%47%4b%67%32%30%37%67%35%75%4e%2f%30%37%56 The complete one-liner including … Read more

Hash params vs url params, when to use which?

Hash params are useful for single page javascript applications, it allows javascript to present the user with a sharable url for state of the application. This is preferred because if you have a single page javascript application and users navigate and load more content via ajax and share the url, without the hash or a … Read more

What is the meaning of # in URL and how can I use that?

Originally it was used as an anchor to jump to an element with the same name/id. However, nowadays it’s usually used with AJAX-based pages since changing the hash can be detected using JavaScript and allows you to use the back/forward button without actually triggering a full page reload.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)