0

In my PHP application, I have applied below rule to redirect non-www to www in htaccess.

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301]  

But after applying this rule, I got into a trouble. System stop sending POST data. Login,registration etc all form have stop working after this rule.

Even I have tried to load login page with http://www.mydomain.com/login.html still it is not working.

How can i get rid of this situation?

Thank you.

Nayan
  • 3
  • 2

1 Answers1

1

You need to have everything pointing at domain with www. If in form you have as action parameter set http://mydomain.com it simple won't work. You need to change it to http://www.mydomain.com

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
  • oh it worked for me. So it means that if i have non-www url in form action parameter and apply rule for non-www to www, it redirect non-www to wwww and flush all my POST data. – Nayan Jul 03 '14 at 11:51
  • Simple when you make redirection POST data are not transferred to new site. In fact I almost never user full path in action so you can have in action only `action='test.php'` and you don't have to worry if your domain is with www or not with www – Marcin Nabiałek Jul 03 '14 at 12:02