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

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!

share|improve this question

1 Answer 1

active oldest votes
up vote 2 down vote accepted
You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO