As a system administrator, you might encounter a common issue where you need to paste a hostname into the address bar to access an internal website or console. The challenge is that most modern browsers default to searching the pasted content using the default search engine, which is often not the desired behavior for me. However, this issue does not occur when using the full FQDN, as the browser correctly identifies it as a URL and opens the intended site directly.
As you can see, I pasted server1 in the URL bar and it redirects to bing search engine with the q=server1 appened as a search query.
The Solution
To solve this, the trick is to add a custom search engine, a feature supported by most modern browsers. By doing this, you can define a custom search query and set your newly created search engine as the default. This approach ensures that when you enter a hostname, the browser directs it appropriately instead of performing an undesired search.
Brower Name | Supported | Location of Search Engine Setting |
---|---|---|
Google Chrome | Yes | chrome://settings/searchEngines |
New Edge | Yes | edge://settings/searchEngines |
Firefox | No | |
Opera | Yes | opera://settings/searchEngines |
On the search engine related page, you’d need to add a new search engine entry and put https://%s in the value of the query. Don’t forget to make this as default search engine, which is particularly useful when you usually paste hostnames directly on the address bar.
See example screenshots for different browsers below.
Chrome
In Google Chrome, the search engine related setting is located at chrome://settings/searchEngines
Name – You can give any name
Shortcut – By using this, you can quickly switch between search engines for each search. But it’s not for our purpose in this blog, so you can give it any name. If you want to know how to use it, see the later section of this blog.
URL with %s in place of query – This is the place we’d need to put our custom parameters to do with our pasted content. Since I just want to redirect https for whatever I pasted in the URL bar, I use https://%s
New Edge
In New Edge, the search engine related setting is located at edge://settings/searchEngine
Opera
In Opera, the search engine related setting is located at opera://settings/searchEngines
Tips: How to use Shortcut of the Search Engine Settings
This is only useful when you want to switch different search engines which are already preconfigured. The usage is as below:
When you type this shortcut and press spacebar, it will automatically recognize the search engine to be used for your current search. See four screenshots below which I tested with google search engine.
So, I just need to type google.com and press spacebar.
After pressing the spacebar, you can continue typing your search keyword.