I have been looking for like three or four hrs with no result(before searching I performed with rules to have an hour but could not get it done)

I'm not sure if you have observed or no but google uses www such as this

if this doesn't have subdomain it will likely be www.google.com/blabla and when there's a subdomain it will likely be earth.google.com/blabla

This is actually the first part

And also the second part, you may already know in symfony web addresses are just like domain.com/index.php/make sure because of the symfony .htaccess file you have access to it via domain.com/test So here's what I attempted so difficult to attain

domain.com/test redirect to www.domain.com/test

world wide web.sub.domain.com/blabla redirect to sub.domain.com/blabla

world wide web.sub.domain.com/ redirect to sub.domain.com (with no index.php XD)

Among the annoying problems I'd was redirecting from domain.com/ to www.domain.com was that whenever redirect it had been like www.domain.com/index.php (And That I hate index.php :P)

Same with there in whatever way with one redirect solve this issue? I am sure I am only some of the one that needs something similar to this and can be a concept for some individuals who will have their website with symfony or any other frameworks Thanks

Here's my complete htaccess file

Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On

  # The admin subdomain returns to the backend
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{HTTP_HOST} ^admin\.mydomain\..*
  RewriteRule ^(.*)$ backend.php [QSA,L]

  # uncomment the following line, if you are having trouble
  # getting no_script_name to work
  #RewriteBase /

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

  # we skip all files with .something
  RewriteCond %{REQUEST_URI} \..+$
  RewriteCond %{REQUEST_URI} !\.html$
  RewriteRule .* - [L]

  # we check if the .html version is here (caching)
  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  # no, so we redirect to our front web controller
  RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

Inside your VHOST config:

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

Also observe that from the esthetical perspective you may would rather take away the www., searching in the technical position (DNS, snacks, ...), it is usually easier to prefix with www., and redirect within the other way.