Make sure you have SEF URLS enabled
The first thing to make sure is that you have SEF urls setup already. Check our Ultimate Joomla SEF URL Guide if you need help with this.
Add the Rewrite to the Htaccess file
Navigate to your Joomla installation root using your host's file manager (example: cpanel >> file manager) or favorite FTP program (example: Filezilla) and edit the .htaccess file.
Note: if you have htaccess.txt please make sure that you go through the Ultimate Joomla SEF URL Guide as noted above.
Add the following code to the .htaccess file:
##### Start ?tp=1 prevention ######
RewriteCond %{QUERY_STRING} tp=(.*)
RewriteRule ^(.*)$ index.php [F,L]
##### End ?tp=1 prevention ######
Save.
That's it. You're done! Now just double check to make sure it's working by going to www.yourdomain.com/?tp=1