I’ve got a php file inside this folder structure:
Web -> script -> gen.php
From this gen.php I want to redirect with the location() function in Javascript to
Web->Index.html
I tried to do it like this:
location = "localhost/Web/index.html"
But I only get a 404 error saying that this path is invalid. What is the correct way to do this?
location, in JavaScript, is not a function. It is a property that you can assign a value to.Any of (assuming Web is exposed on the URL and isn’t just an internal directory):
http://localhost/Web/index.html//localhost/Web/index.html/Web/index.htmlindex.htmlHowever, redirects should usually be handled with HTTP, so you are likely better off with:
(Note that while most browsers will recover from a relative URI in the location header, the specification requires an absolute URI).