Home Cant redirect using php's header function
Reply: 0

Cant redirect using php's header function

user692
1#
user692 Published in April 24, 2018, 6:42 am

I am having a very strange issue. I am doing bunch of redirects on a website and want to redirect '/old_url' and '/old_url.html' to '/new_url'. Everyting works fine with '/old_url', however the '/old_url.html' always returns 404. After inspecticting the response header, I can see my redirect listed there, but it simply doesnt redirect. Here is my code

 if($query && !headers_sent()){
        header('Location: ' . $query[0]['new_url'], true, (int)$query[0]['status_code']);
        exit;
 }

And here are the response headers from the browser.

As you can see there is a location header. Anyone knows why it is not working?

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO