Redirect all pages to new domain with Htaccess

if you want to change your domain name without affecting SEO Ranking in search engines than you should think about 301-page redirect, with 301 redirect you can move your web application to new domain freely.

we can use different methods for setting 301 redirects from old domain to new domain but I am gonna use .htaccess. this method is most preferred, effective and easy.

create the .htaccess file in your old website root folder then put below lines in the .htaccess file.

Here, this one redirects everything after the domain name on the URL to the exact same copy on the new domain URL., for example, will redirect to

if you remove $1 , all pages redirect to home page Ex: this will effect search engine rankings.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
1 year ago

i have a codeigniter project ..i want to transfer all file pages to new domin but is found error404 how i can redirect all pages Protection Status
Would love your thoughts, please comment.x