My *.000webhostapp.com site does not work with www

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]

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 :slight_smile:

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

yes :slight_smile: :slight_smile:

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???

My website now works only without www.
I want that it works also with www.

what is your domain name??

There is the link. :slight_smile:

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” !!!

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!).

No way to solve the situation?

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.