Hide some files from robots

How to hide .sql files on a website from robots.
Shared hosting.  I can not store files on a lower directory.

.sql file must stay in folder.

Please do not say to delete .sql file
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What facilities do you have access to in the shared hosting (e.g. cPanel)
and: Do you know what type of web server is being used? (e.g. Apache)

if Apache; a .htaccess file could be to deny access like this:

<FilesMatch "\.(htaccess|htpasswd|sql|ini|log|sh|inc|bak)$">
Order Allow,Deny
Deny from all

note: a spider (robot) should honour robots.txt but there is no guarantee they all will

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
Why must the .sql file stay in the folder?  No database that I know of can directly use a *.sql file.  Such files are used for import and export, not for normal operations.

One option is to put the files in a password protected directory.  That will prevent external access while allowing access to files on the web server.
Add one line to Robots.txt file ,

User-agent: *
Disallow: /Foldername/

eg:- Your folder name is "junk". then edit  to.

User-agent: *
Disallow: /junk/
Ray PaseurCommented:
If you do not have any anchor tags (links) to the files, you will have hidden them effectively from the robots.  Robots can only find the files that are linked; they cannot make up names and guess.
rgb192Author Commented:
shared hosting has an .htaccess file

I like this answer the best
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.