How to do a wildcard redirect?

Hi friends,

Can someone please guide me how can I redirect all pages of my old domain to my new domain i tired the following code but it’s only redirecting the homepage and not redirecting any other pages.
`

RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [NC]

RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]

`

I have used this syntax a few times, not sure if its exactly what you need or not

RewriteCond %{HTTP_HOST} =olddomain.com [NC]
RewriteRule ^(.*)$ http://newdomain.com%{REQUEST_URI} [L,R=301]

or, since I’m suggesting to use REQUEST_URI you could simplify the Rule:

RewriteCond %{HTTP_HOST} =olddomain.com [NC]
RewriteRule ^ http://newdomain.com%{REQUEST_URI} [L,R=301]

good luck !!

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule (.*)$ https://newdomain.com/$1 [R=301,L]
</IfModule>

also your might want to clear your browsers cache.