Categories: Hacks

.htaccess redirect from old domain to new domain

Htaccess is a powerful tool. Simplest mistake in syntax can cause problems. In this post i am talking about the permanent redirect, ie 301 redirect of old domain to new domain.

Case 1: if you need to keep the url structure of old domain in the new one

eg: http://olddomain.com/hello gets redirected to http://newdomain.com/hello

Do this: if you plan to keep the url structure

+ve: Helps to retain the seo

Redirect 301 / http://newdomain.com/

Case 2: if you don’t need the url structure

eg: http://olddomain.com/hello gets redirected to http://newdomain

Do this: if you dont plan to keep the url structure

RewriteEngine On
RewriteRule ^(.*)$ http://newdomain.com/ [R=301]

Enjoy smile

Mithun

Recent Posts

Happy New Year 2026

Like I have said last year, this is an abandoned blog, lol. But, hey, We…

2 days ago

Quick release mount systems Compatibility chart

Plate Base FALCAM F38 Ulanzi Uka PGYTECH SNAPLOCK PeakDesign Falcam F38 ⬤ ✕ ✕ ✕…

10 months ago

Happy New Year 2025

I really thought I would keep up with the blog in 2024. But, it didn't…

1 year ago

Happy New Year 2024

Oh boy, there were a lot of things that happened this year. Like last year,…

2 years ago

Happy New Year 2023

This has become a abandoned blog. I will try to fix things this year. More…

3 years ago

Happy New Year 2022

Let me start off by saying, i have more blog posts this year than the…

4 years ago

This website uses cookies.