Here’s how you can redirect the domain without changing the URL step by step.
-> Log into cPanel
-> Open File Manager
-> public_html
-> .htaccess
-> Now Right-click on .htaccess, Select Edit
-> You will see a box in which click on the Edit button, shown in the Right downside corner.
Suppose visitors visit abc.com, but you want the visitors to redirect to abc2.com without changing the URL. Then, you need to write the below-mentioned Line using the .htaccess file.
RewriteEngineOn
RewriteCond%{HTTP_HOST} ^example1.com RewriteRule ^(.*) example 2 understand – Interesting articles to read. Free tutorials and HOW-TOs [P]
The first Line acknowledges the Apache to begin the rewrite module.
The redirection from the source domain to the target domain is indicated on the Second Line.
You can also write these lines in your .htacccess
-> RewriteCond%{HTTP_HOST} ^example1.com RewriteRule ^(.*)
example 2 understand – Interesting articles to read. Free tutorials and HOW-TOs [P]
Besides, you can also redirect the IP address to another website. You need to add the following lines to the .htaccess file.
RewriteCond%{HTTP_HOST} ^192.168.45.11 RewriteRule (.*) example 2 understand – Interesting articles to read. Free tutorials and HOW-TOs [R=301,L]
Now that this redirect is complete, the server will show you the result.
The L indicates the Last rule in the run.
The R=301 indicates that the web server permanently sends a 301 to the requesting browser or search engine.