Hi all. I’d like to create friendly URLs for my pages but do not know enough about htaccess. I’d like the following pages (of which there are 100,000s of thousands of combinations) to go directly to /compare.php to be processed:
When I echo $URLfriendly, the location appears fine. I can even copy/paste it into the address bar of my browser, and it displays perfectly. But when I keep the line commented and allow the header redirect, I get a 404 error. How is this happening?
In case my htaccess has anything to do with it:[code]ErrorDocument 400 /error.php?code=400
ErrorDocument 401 /error.php?code=401
ErrorDocument 403 /error.php?code=403
ErrorDocument 404 /error.php?code=404
ErrorDocument 500 /error.php?code=500
Oh my. This is so odd. I tried everything I could think of, and then finally during some testing I added echo ‘test’; die(); after header(), and suddenly it worked. I realized that I needed to specify header(); die(); !! That was it!
Why do I need to specify die() after a header() redirect? Does the browser not immediately leave the current page when it receives the header command? If not, should all header redirects be followed by die() commands as good practice?