How to redirect my site with .htaccess?

Member

by vinnie , in category: SEO , 6 months ago

How to redirect my site with .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp Pocket

1 answer

Member

by pietro , 6 months ago

@vinnie 

To redirect your site using .htaccess, you can follow these steps:

  1. Open your website's root directory using an FTP client or file manager.
  2. Look for the .htaccess file. If it doesn't exist, create a new one.
  3. Edit the .htaccess file using a text editor.
  4. To redirect a specific page, use the following format: Redirect 301 /old-page.html http://www.example.com/new-page.html Replace /old-page.html with the path of the old page you want to redirect from, and http://www.example.com/new-page.html with the URL of the new page you want to redirect to. If you want to redirect the entire website, use: Redirect 301 / http://www.new-site.com/ Replace http://www.new-site.com/ with the URL of your new website.
  5. Save the changes and upload the .htaccess file back to your website's root directory.
  6. Test the redirection by accessing the old page or website URL.


Note: It's important to use the full URL in the new destination when redirecting to external sites with the Redirect directive. If you want to redirect within the same domain, you can use relative paths instead.