Many webmasters were desatisfied of WordPress’s built-in search feature, and they wanted to reduce all of the load on their website. In common they rely on custom search engine elements via Google CSE. But having this search element on your website is NOT a option if you wanted to use a 2-page format.
The Experiment
I created a subdomain to reduce costs of purchasing a new domain, and I created the following pages within my CPanel of my website. I created the important index.html file. I implemented a search box with plain html format, and customized it with my liking… After I created this important file; I created the results.html file… this is important for my dedicated search site to have this file because, I need to have multiple pages because, I do have a plan to add more pages to my search site to add additional info in the future.
I performed a search to find out if my experiment works on that site within the subdomain itself… and it works! Earlier, I encountered some “404” errors when performing a search. I place a “results only” script inside the results.html file for the results to register. This is necessary if I wanted to create my own version of a search engine.
I set “s” as my query prefix. Without it… the search box will not work!
Now I can able to centralize search results like a pro. And that also enables me to have a secured version of my subdomain because, I can able my visitors to search for anything interesting.
Why You Would Need A Centralized Search Engine For Your Site?
Reduces load on php-based websites like WordPress. And a set of 2 files with an html format… you can enable only general search features that will NOT affect your websites.
To Do This
Follow these instructions carefully:
- Create either a subdirectory, or subdomain where you wanted to have your 2 html files. Its strongly recommended to rely on subdomains. Don’t create a new site within WordPress,–create a subdomain within your hosting panel instead.
- Give your dedicated subdomain, or directory a name. I gave my subdomain a name, “search”. Be sure to confirm your subdomain is created. If it’s successful… your subdomain is ready to use.
- Go to your folder that is associated with your subdomain, and create a file. Name it “index.html” and copy the code below:
- Replace “Custom_Title” with anything you like. But don’t place your search results element just yet. Customize, and style with your liking.
- Save your file, and view it on your website via your new subdomain to test, but don’t run a search just yet!Create the another file, and copy the same code above.
- Visit the Google Custom Search Engine website, and go to your custom search engine. Navigate to “Look and Feel”, and set it to results only. Be sure to set your query prefix as a way for your results to register, after you saved your settings and grabbed the code. Select all of the text and copy it.
- Replace the html comment with your search reselts element.
- Save your file.
- Open your website, and perform a search. If it works… you are done. If not, you may need to varify if you named your second file as “results.html. If you didn’t name this file correctly… rename it, and try again. Don’t give up on one try… keep trying until you succeed!
- Wait for your users to use your search box on your dedicated search site. If you had an SSL certificate for your subdomain… you can add a secure connection.
Now you have a centrailized search engine that will be used to reduce server loads. However; you can still do the same,–if you still rely on shared hosting. But you may need to be careful how your site is structured.
If you’re still not sure if your CPanel enables you to have subdomains… check with your hosting provider.
If you were using directories… you may need to name your search site something different,–if your WordPress site has its own search system.
If the users are not teleported to your new search site, you may need to implement a same search box that links to your search site.