Last active
March 13, 2024 19:01
-
-
Save elias1435/c2cf71442fd923dd6d39f78003a1a1bf to your computer and use it in GitHub Desktop.
Sometime we need to redirect a url directory. Use this index file to redirect the visitors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="refresh" content="0;url=https://www.exmaple1.com/pages/details/"> | |
<title>Redirecting...</title> | |
</head> | |
<body> | |
<p>If you are not redirected automatically, <a href="https://www.exmaple.com/pages/details1/">click here</a>.</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sometime need to exclude certain url. we can do this easily
`<?php
// Define the excluded URLs
$excluded_urls = array(
"/wp-content/uploads/2023/04/link.png",
"/team/memeber-name/"
);
// Get the requested URL
$request_uri = $_SERVER['REQUEST_URI'];
// Check if the requested URL is in the excluded URLs array
if (!in_array($request_uri, $excluded_urls)) {
// Redirect to 'https://www.example.com' for all other URLs
header("Location: https://www.example.com", true, 301);
exit();
}
?>`