Loading...
  • Friday, October 4, 2024

Knowledge Base

How to redirect a page to another page or website using .htaccess?

If a page on your website no longer exists and you want to redirect it to your new page or site, then you can use the .htaccess file for redirection without waiting.


1. Redirect from old domain to new domain (create a .htaccess file & add below code):

RewriteEngine on
RedirectPermanent / http://example.com

2. Redirect from a page/directory to another domain or the main domain or Redirect from a specific page to a domain (create a .htaccess file & add below code):

RewriteEngine on
Redirect 301 /mypage.html http://example.com


3. Redirect from a page to another page or Redirect from a page/directory to another page ((create a .htaccess file & add below code)):
RewriteEngine on
Redirect 301 /oldpage.html /newpage.html


To using above redirection rules, you can redirect one domain to another or one page to another. However, don't forget to change your actual page name or website url!