Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Change Safari's default search engine - revisited' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Change Safari's default search engine - revisited
Authored by: gavinh on Jun 24, '03 06:54:19AM

My way of getting round this is to use one line of PHP code and the webserver installed as standard on OS X!
If you want to give it a try this is what you have to do (all of this is easiest done in Terminal):

1. Create a directory in your webservers root by typing:

mkdir /Library/WebServer/Documents/www

2. Create your PHP script by doing the following:

vi /Library/WebServer/Documents/www/search.php

3. While the file is open in your terminal window push the 'i' key on your keyboard (this puts you into Insert mode so that you can type into the file). Now type the following:

<?php header("Location:".$search."&btnG=Google+Search&meta=cr%3DcountryUK%7CcountryGB"); ?>

4. Be aware that the above line of code must be on a single line and not over several lines! Once you have typed this in hit the 'esc' or Escape key to come out of Insert mode. Now type:


5. And hit the Return or Enter key. (For those that don't know ':wq!' is the command to Write the file and Quit Vi)

6. Now you need to edit the Safari executable. Type:

vi /Applications/

7. Once the file is open in your teminal window to search for the entry to be deleted type:


8. You will be taken to the piece of code that contains ''. You need to replace this piece of code. To do this use the 'x' key on your keyboard to delete, then hit the 'i' key again to go in to Insert mode and type:


9. Hit the 'esc' or Escape key and then type:


10. And hit the Return or Enter key.

Thats it! To explain what we've done, the Safari executable now looks at a script on your local machine which then redirects to the correct search engine. I have used '&000000000' to pad out the line as mentioned in an earlier post as the entry must be the same length as the original.

I hope this is of some use to people.

[ Reply to This | # ]
Change Safari's default search engine - revisited
Authored by: aranor on Feb 20, '04 02:08:26AM

Ah, but that depends on register globals being turned on. Try using $_GET['search'] instead of $search

[ Reply to This | # ]