Samuel Tulach Samuel Tulach - 1 year ago 65
Javascript Question

Redirect from URL (PHP or JavaScript)

Is it realistic to do when I write URL to be redirected to index.html? I need use PHP and HTML or javascript. Thanks in advance for your answer.

How to make a redirect in PHP? - helped! Thanks to all!

Answer Source

if you really need do that, could be done better using .htaccess if you are using apache, if you using any other server like ngnix or light-http. If your are try to do that only with PHP or JS, i'll prefer to do in PHP, becose it'll be more quecly and not need to spent time in load javascript into browser. in PHP will be:

if($_SERVER['REQUEST_URI']==='redirect.php?index.html') header('location:/index.html);

sorry if request uri var is other in your server envoirement.

expect will help