How to redirect page by using .htaccess?

Member

by dana , in category: Third Party Scripts , a month ago

How to redirect page by using .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by dalton_moen , a month ago

@dana 

To redirect a page using .htaccess, you can use the following code:

  1. Redirect from one page to another page:
1
Redirect /oldpage.html http://www.example.com/newpage.html


This code will redirect any requests for "oldpage.html" to "newpage.html".

  1. Redirect to a different domain:
1
Redirect permanent /oldpage.html http://www.newdomain.com/newpage.html


This code will redirect any requests for "oldpage.html" to "http://www.newdomain.com/newpage.html" with a permanent redirect (301).


Make sure to save the .htaccess file after adding the redirects and test to ensure that they are working correctly.