I am trying to redirect all from non-www to www. So example.com redirects to www.example.com I enabled Rewrite Engine in Apache and added this to .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule ^(.*) http://www.example.com/$1 [R=301]

At first look everything worked perfectly. But when trying to use my website's log in form to view areas of the site accessible only to logged in users it just appears to refresh the page. Nothing happens.

I've been trying to fix this for quite a while and haven't found any similar problems. Any help is appreciated! Thanks.

有帮助吗?

解决方案

Silly me. Somewhere I declared the website as a variable in the form of example.com. Changed it and it works now.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top