My website uses .htaccess redirect as below:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
The issue is that
Warning, no 301 redirects are in place to redirect traffic to your preferred domain. Pages that load successfully both with and without www. are treated as duplicate content! Not all versions of your page point to the same URL.
URL Resolved URL:
http://example.com/inner-pageredirects tohttps://example.com/inner-pagehttp://www.example.com/inner-pageredirects tohttps://example.com/index.php/inner-pagehttps://example.com/inner-pageredirects tohttps://example.com/inner-pagehttps://www.example.com/inner-pageredirects to
https://example.com/index.php/inner-page
Why the same URL is behaving differently with browser. What should I change in the .htaccess file so that it can redirect to the proper URL? I'm wondering how this strange behaviour can happen?
What is the solution so that they all redirect to only
https://example.com/inner-page
any help will be highly appreciated.