So lets say that I have a site (wordpress installation)hosted at site.hoster.com and a Domain that I purchased that is example.com
How can I redirect the user from example.com to site.hoster.com without changing the URL.
I have a added a CNAME Record but the site's url is changing when i try to enter example.com.
I have tried a bunch of solutions found here on stackoverflow but I can't get it to work.
The site is an apache virtual host.
I have added ServerAlias in configuration of the Apache virtual host but it does not work.
Here is the .htaccess file of the site
`
# BEGIN WordPress
# The directives (lines) between `BEGIN WordPress` and `END WordPress` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN ShortPixelWebp
# The directives (lines) between `BEGIN ShortPixelWebp` and `END ShortPixelWebp` are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
# END ShortPixelWebp
PS : I have tried the .htaccess 301 redirect method with varius implementations but it still does not work.
EDIT: Forgot to mention that there is an A record pointing to www CNAME record which point site.hoster.com
Thanks in advance.