How do I set up Google Search for my site only

Hello,

I am trying to update my Google Search box code but even when I choose “my site only” and enter my url with the * it doesn’t work. When I try it out in my website, I get results for the web and not my site. Is there any way to fix this like with the old code that you could just search your site??

Thank you!!!

Hi b3790302. Welcome to SitePoint. :slight_smile:

There is some standard code you can add to your site to create a Google search form. You just need to replace the domain with your own site’s domain (see in red):

<form method="get" action="http://www.google.com/search">
    <label for="q">Search this Site</label> 
    <input type="text" class="text" name="q" id="q" size="31" maxlength="255" value=""> 
    <input class="submit" type="submit" value="Search">
    <input type="hidden" name="sitesearch" value="[COLOR="Red"]mydomain.com[/COLOR]">
</form>