I learnt about 301 redirection when I moved my wordpress site from earlier domain to this new domain.
Htaccess redirect is better than the meta refresh or redirect tag because there is no delay as the browser reads the .htaccess file first. Here is how it works.
Go to your site’s root folder, download the .htaccess file to your local computer and edit it with a plain-text editor (ie. Notepad). If you are using FTP Client software and you don’t see any .htaccess file on your server, double check your setting and make sure you have turn on invisible / system files.
To Redirect Certain Page(s):
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html Redirect 301 /oldpage2.html http://www.yoursite.com/folder/
To Redirect Entire Site:
Redirect 301 / http://www.new-site.com/
This can also done by placing an index.php file in the place where you had your earlier site. But that’s not recommended and will reduce the response time of the site.
- PHP syntactic sugar code example - September 5, 2021
- Python convert random string date format to Datetime - July 12, 2021
- Laravel Custom Exception Handlers - March 28, 2019