I can see why the first line has a problem - and you should be able to see it, too! Because the RewriteRule can ONLY examine the {REQUEST_URI} string (which does NOT contain the {QUERY_STRING}), any attempt to access it (or the {HTTP_HOST} or other Apache variables) is doomed to failure.
My ht_access file contains the following:
Hmmm, that’s the .htaccess file! No filename, just the htaccess file extension.
Options +FollowSymLinks All -Indexes
RewriteEngine on
RewriteRule ^/p=([0-9]+)$ /my-property/index.html?p=$1 [L,R=301]
# the ^/ will ONLY match on an Apache 1.x server
# p=(\\d+) is obviously the query string
# use RewriteCond %{QUERY_STRING} p=(\\d+) to capture the numeric value of p
# followed by RewriteRule index\\.php$ my-property/index.html?p=%1 [R=301,L]
RewriteRule index([0-9]+)\\.html$ index.html [L,R=301]
# Strips digits off index#.html
RewriteRule list-page([0-9]+)\\.html$ /my-property/index.html?p=$1 [L,R=301]
# captures digits appended to list-page#.html and sends then as the
# value of p to my-property/index.html in the new/replacement query
# string
RewriteRule ^(.*)\\.html $1.php [L]
# redirects EVERY .html file to its .php equivalent