> 
> **Possible Duplicate:**  
> 
> [How to identify if referrer is a 301 redirect](https://stackoverflow.com/questions/1963328/how-to-identify-if-referrer-is-a-301-redirect) 
> 
> 
> 

Using htaccess Im doing a 301 redirect to redirect old urls to the new urls, the issue is the url contains the id that is stored in the db. But I have a new db with new ids so now when the old url redirects to the new url a different record loads on the page. So what I did was store the old ids along with the new ids so I know what old id belongs to the new id. However how can I detect someone is trying to access the old url? Is there a way in php to detect the person coming to the page is being redirected via a 301? I dont want to add anything new to the url due to SEO reasons so I really need to know if I can detect if they came to this page via 301 redirect. Hope this makes sense.