htaccess 0

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 visitors to a new page or website, you can use the .htaccess file for immediate redirection. This is especially useful for maintaining SEO value and providing a better user experience when URLs change.

  • Redirect from a specific page to a different domain:
    RewriteEngine on
    Redirect 301 /mypage.html http://example.com

    This will redirect anyone visiting yourdomain.com/mypage.html to http://example.com.

  • Redirect from one page to another page on the same domain:
    Redirect 301 /oldpage.html /newpage.html

    This will redirect yourdomain.com/oldpage.html to yourdomain.com/newpage.html automatically.

Tips:

  • Always back up your .htaccess file before making changes.
  • Use 301 for permanent redirects to preserve SEO rankings.
  • After editing .htaccess, clear your browser cache to test the redirect.
  • If you are using WordPress, ensure that custom .htaccess rules are placed above the # BEGIN WordPress line to avoid conflicts.

Was this answer helpful?

One email a month. Endless business benefits.

Don't miss out on WMTWWFY — the newsletter that keeps your website fast, safe, and visible.

« Back
Spinner
aluminium-anthropoid Security Check