On my site im using friendlyURL by .htaccess. but site receiving SQL Injection queries. how can i protect my site from sql injection by htaccess?
Asked
Active
Viewed 2,676 times
0
-
You can't - you'll need to protect your site's code. You'd have to show what language it is in, and how the injections come through, for hints on how to fix it. – Pekka Apr 04 '13 at 07:20
-
2Add `Deny from all` to `.htaccess` then tidy up the code in `index.php`! – Quassnoi Apr 04 '13 at 07:22
-
Is this question really duplicate? – vp_arth Mar 29 '14 at 09:25
2 Answers
3
You can't protect index.php from sql-injection using .htaccess.
To protect your site you have to rewrite your code. That's the only way.

Community
- 1
- 1

Your Common Sense
- 156,878
- 40
- 214
- 345
-1
You cannot protect you site form sql injections with .htaccess. .Htaccess will prevent unauthorized access to your web site or parts of it. The only way to prevent sql injections is to write safe query code by parametrize your sql queries.
Do not you queries like
"Select * from TABLE where COLUMN = '$VARIABLE'"
Use this:
'SELECT * FROM TABLE WHERE COLUMN = $1', array($variable)

idipous
- 2,868
- 3
- 30
- 45