I was fighting with it for some time but I am unable to find solution and I would like to ask you for your help.
I have my website hosted on PythonAnywhere. I bought a domain from my "local" country seller. I attached it, set cname dns etc. and it is working but only if I write "www." first. I read that PA only accepts this version of address.
I asked my domain provider what can I do about this and he said that I should create .htaccess file to redirect (301) people from domain.com to www.domain.com
I tried many different .htaccess templates with various variations with "1$" and without, still I receive error:
Not Found
The requested resource was not found on this server.
And another weird part for me is that it is "directing" to this address:
https://www.domain.info/home/mynick/domains/domain.info/public_html/www.domain.info
So it is directing to "www." address but it is looking for some weird things in my public_html?
And no matter what I change in my .htaccess this address from above stays the same. What I did wrong?
EDIT:
I am sorry if I did not provide enough information.
I edited file .htaccess in folder "public_html" of my domain.
I tried many different versions like:
Redirect 301 / https://example.com/
And:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteCond %{REQUEST_URI} !/(.+) [NC]
RewriteRule (.*) http://newdomain.com [R=301,L]
And many other variations but problem from above still exist.
EDIT2:
I also tried these:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]