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

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

user987
1#
user987 Published in June 25, 2018, 7:50 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!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.31641 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO