Ubuntu
Ubuntu is a popular open-source operating system that delivers a secure, stable, and user-friendly computing experience for desktop, server, and cloud environments
To replace a domain name only on certain file types using htaccess, you can use this snippet
RewriteEngine On turns on the Apache mod_rewrite module.
RewriteBase / sets the base URL for rewriting.
RewriteCond %{REQUEST_URI} \.(html|php)$ [NC] matches only files with the extensions ".html" or ".php".
RewriteCond %{HTTP_HOST} ^old-domain\.com$ [NC] matches only requests for the old domain name.
RewriteRule ^(.*)$ http://new-domain.com/$1 [R=301,L] redirects all requests for files with the specified extensions to the new domain.
Note that the R=301 flag is used to indicate a permanent redirect, and the L flag is used to stop further rewriting. You should also replace "old-domain.com" and "new-domain.com" with the appropriate domain names for your site.
Inside a terminal window type the following command:
For RHEL/CentOS/Oracle/Fedora
Stop Apache
systemctl kill httpd
Permanently stop Apache
sudo systemctl disable httpd && sudo systemctl stop httpd
For Ubuntu/Debian
Stop Apache
systemctl kill apache2
Permanently stop Apache
sudo systemctl disable apache2 && sudo systemctl stop apache2