fabicio
February 12, 2017, 2:25pm
#1
Hi everyone.
I have my website (“mywebsite”.000webhostapp.com) and I cannot access from www .“mywebsite”.000webhostapp.com. It’s work only without www.
I’ve tried to load and modify .htaccess file with this rule:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^mywebsite.000webhostapp.com$ [NC]
RewriteRule ^(.*)$ http ://mywebsite.000webhostapp.com/$1 [R=301,L]
but nothing changes.
I’ve also tried to add a free subdomain, but also the subdomain works only without www.
What can I do?
Thanks
You have not mentioned “www” in rewrite rule!!!
Try this:-
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} ^mywebsite.000webhostapp.com$ [NC]
RewriteRule ^(.*)$ http://www.mywebsite.000webhostapp.com$1 [R=301,L]
fabicio
February 12, 2017, 3:16pm
#3
Thank you for the answer.
With your code also the website without www does not work.
I’ve tried the reverse, I mean:
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} ^www.mywebsite.000webhostapp.com$ [NC]
RewriteRule ^(.*)$ http://mywebsite.000webhostapp.com$1 [R=301,L]
But still doesn’t work.
Follow as i suggested!!!
After making the changes in your .htaccess file(as i suggested)…clear cache and data of your browser!!!
Now try to load your website…it should work fine with www!!!
If you have still facing the…PM me your login details…I do from here…on your behalf
fabicio
February 12, 2017, 4:16pm
#5
Sorry but…From here your method is to force NON-WWW to WWW.
Not what I want: force WWW to NON-WWW.
Where should I put .htaccess file? In folder public_html?
Thanks again
fabicio
February 12, 2017, 4:39pm
#7
No way, your code turn down also my website without www, because it is redirected to the www website, and it doesn’t exist.
what is your domain name??
And clear me that you want your website to be accessed with www or not???
fabicio
February 12, 2017, 4:51pm
#9
My website now works only without www.
I want that it works also with www.
what is your domain name??
Copy this as it is in your .htaccess file.
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} ^fabrizioarduino.000webhostapp.com$ [NC]
RewriteRule ^(.*)$ http://www.fabrizioarduino.000webhostapp.com$1 [R=301,L]
After this clear your browser cache and data…
Now try to load your website…it should work fine with “www” !!!
fabicio
February 13, 2017, 9:49am
#13
As I told tou yesterday, your method does’t work.
Now both the www and non-www websites don’t work (check it by yourself).
This method redirect my NON-WWW website to the WWW one (that doesn’t exist!).
fabicio
February 14, 2017, 7:30am
#15
No way to solve the situation?
fabicio
February 14, 2017, 10:58am
#17
The solution posted above doesn’t work for me.
With this code:
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_HOST} ^fabrizioarduino.000webhostapp.com$ [NC]
RewriteRule ^(.*)$ http://www.fabrizioarduino.000webhostapp.com$1 [R=301,L]
both the versions with or without www don’t work.