I know that too much questions exist for htaccess redirection, but I couldn't find the exact solution. I'm sorry if there exist a matching question.
In my public html (webroot) folder there was following htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
Then to redirect URLs with "www" to "non-www" I added two lines. And file became like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
So the problem is, www.example.com redirects to example.com but www.example.com/mycontroller/ weren't redirected to example.com/mycontroller/
How can I solve this?