Home htaccess variable 301 redirect from URL (but with odd structure)

# htaccess variable 301 redirect from URL (but with odd structure)

user4478
1#
user4478 Published in September 19, 2018, 3:18 am

So I'm doing a site design and the URLS are changing. However, the old site has a very odd URL structure that I'm finding it hard to redirect.

Basically, just needing to grab the variable from the URL, and then pass it to another page that then does the redirect. HOWEVER, here is my issue. The old urls are NOT actually query strings.

/rental/house.html&ID=405313


Notice how it is missing the normal ? instead of the & ? Odd, right?

So currently, I have

RewriteCond %{QUERY_STRING} (^|&)ID=([^&]+)($|&) RewriteRule ^rental/house\.html$ /newredirect.cfm?id=%1 [L,R=301]


However, this only works IF I have the ? in the url, such as....

/rental/house.html?ID=405313


Furthermore, it's not passing the variable so I obviously have an issue there as well.

Any help is greatly appreciated! Thank you!