I recently managed to direct all URLs from non-www to www as I had an SEO error regarding duplicate websites.
Once I have applied www rules then all my URLs start showing index.php?page=
which doesn't look pretty.
Here are my current .htaccess
rules:
RewriteEngine On
RewriteBase /
RewriteRule ^([-a-zA-Z0-9]+)$ index.php?page=$1
RewriteCond %{HTTP_HOST} !^www.example.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
RewriteEngine On
RewriteBase /
# Removes index.php?page=$1
RewriteCond %{THE_REQUEST} ^.*/index.php?page=$1
RewriteRule ^(.*)index.php?page=$1$ https://www.example.com/$1 [R=301,L]
RewriteRule ^(.*)index$ https://www.example.com/$1 [R=301,L]
I have tried the code above and it didn't work. Is there anything I am missing?