如何在htaccess中将www重定向到没有www的内页

I was working on web based ifsc code search engine called Myifsccodes.com. I am the only person who developed it fully using Php and mysql. I made it redirect from WWW version to without WWW for home page in Bluehost Cpanel that uses htaccess 301 redirect. Its working fine for home page. But recently i found that, if i put www for inner pages they are not redirecting to the without WWW version, which is a huge duplicate problem for site's SEO.

I tried various fixes from Stackoverflow other similar questions, but nothing works accurately. This question is my last hope to fix it with experts here.

Here is my current .htaccess code

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.myifsccodes\.com$
RewriteRule ^/?$ "http\:\/\/myifsccodes\.com\/" [R=301,L]

# Use PHP54 Single php.ini as default
AddHandler application/x-httpd-php54s .php

# For security reasons, Option followsymlinks cannot be overridden.
Options +SymLinksIfOwnerMatch

RewriteCond %{REQUEST_FILENAME} !-f

# data compression
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript

# Url format sample http://myifsccodes.com/example-bank

RewriteRule ^([a-zA-Z0-9_-]+)/$ /bankdetails2.php?banknamefromhtaccess=$1
RewriteRule ^([a-zA-Z0-9_-]+)$ /bankdetails2.php?banknamefromhtaccess=$1

I want to achieve below redirection;

My preferred version of this page http://myifsccodes.com/canara-bank

And this URL http://www.myifsccodes.com/canara-bank should redirect to above URL.

Similarly, 2nd level sub folder URLs should also redirect to non-www version of their respective page.

Example: This URL http://www.myifsccodes.com/canara-bank/delhi should redirect to this one http://myifsccodes.com/canara-bank/delhi

Please help me fix this issue as soon as possible.

Try the following

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.myifsccodes\.com$
RewriteRule ^/?$ "http\:\/\/myifsccodes\.com\/" [R=301,L]

Into

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]