This repository contains various techniques for implementing webpage redirects using HTML, JavaScript, and server-side approaches.
index.html
: HTML-based redirect using the<meta>
tag.redirect.html
: JavaScript-based redirect.app.js
: Node.js (Express.js) server-side redirect.redirect.php
: PHP server-side redirect..htaccess
: Apache server configuration for redirects.
Open index.html
in a web browser. The page will redirect to https://www.newpage.com
after 5 seconds.
Open redirect.html
in a web browser. The page will redirect to https://www.newpage.com
immediately or after 5 seconds if the setTimeout
function is uncommented.
- Make sure you have Node.js and npm installed.
- Run
npm install express
to install the Express framework. - Run the server with
node app.js
. - Open
http://localhost:3000
in a web browser. The page will redirect tohttps://www.newpage.com
.
Upload redirect.php
to a PHP-enabled server. Access the PHP file in a web browser. The page will redirect to https://www.newpage.com
.
Add the .htaccess
file to the root directory of your Apache server. Access http://yourdomain.com/oldpage.html
in a web browser. The page will redirect to https://www.newpage.com
.