Hi,
I've got big problem because my page doesn't work with www but works without www i.e domain.com. I don't know why. I've written to my hosting support but they check hosting setting and tell me that everything set properly on server but it's a magento2 problem. Maybe someone had similar problem and can help me. I will be really grateful because i've looked problem for few days and i can't find.
Solved! Go to Solution.
I've change to this lines and it works:
RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
I hope will works correctly finally
Can you please check once you web url in magento admin?
Admin->Store->Configuration->General->Web
Url is with www or not?
Try to update once if it is not with www. for example: https://www.weburl.com/
Are you using Apache or nginx?
Url is without www. When i change url to www.domain.com i can't access to domain without www In chrome i've got message: "www.domain.com redirected you too many times". I'm using Apache.
@patryk_przebiro
Try once the following:
You need to follow below steps :
1 ) check in system >> configuration >> Web >> Unsecure and Secure check correct url are setup or not.
2) .htaccess changes :
RewriteCond %{HTTP_HOST} ^yoursitename.com$ RewriteRule (.*) http://www.yoursitename.com$1 [R=301]
It's working now! But i can see http://mywebsite.com/index.php? How can i remove this index.php?
To remove index.php from the url:
Change following setting from the admin:
1 Stores > Configuration > Web
2 expand the Search Engine Optimization section
3 set Use Web Server Rewrites to “Yes.”
4 When complete, tap Save Config
If not work then change following in .htaccess as well.
Replace the code below:
#RewriteBase /magento/
with
RewriteBase /
Then, right after, add the following code:
RewriteCond %{THE_REQUEST} ^.*/index.php
RewriteRule ^(.*)index.php$ http://www.yourdomain.com/$1 [R=301,L]
RewriteRule ^index.php/(admin|user)($|/) - [L]
RewriteRule ^index.php/(.*) $1 [R=301,QSA,L]
@patryk_przebiro
Did it work for you?
Unfortunately not Previously solution however doesn't work too
Because i've set .htaccess configuration to earlier and only without www works. I don't know why works with www earlier ;o
Revert your recently changes and then try one by one.
Clear cache and try once browser private mode.