301 Redirect for entire domain name


New Member
Searched a lot on Google and I haven't found the answer, so apologies if this has been asked.

I am changing the domain for a web server (WP/OpenLiteSpeed/Ubuntu).

Currently the website is fully accessible through either domain — SSL works. All content is served from my URL, let's call it myurl.com.

It's still accessible from the old URL, let's call it oldurl.com. All content (images etc.) is on myurl.com.

How and where do I write a rewrite/redirect rule so that any page loaded on oldurl.com is displayed as myurl.com in the bar? And so Google knows it's a 301 redirect?

I've tried redirect 301 "/" "myurl.com/" in the .htaccess file (at the bottom) but it seemed to have no effect.

If I have to put rewrites into the OLS admin panel, can someone guide me on the syntax please?

I have slightly different need. Can you help me

site1.com/blog1 to site2.com/category1/blog1
site1.com/blog2 to site2.com/category2/blog2
site1.com/category1/blog3 to site2.com/category1/blog3