ust to be sure, I set up your redirect locally:
<VirtualHost *:80>
ServerName www.ddddd.com
DirectoryIndex index.html index.php
DocumentRoot E:/temp
<Directory "E:/temp">
Order Allow,Deny
Allow from 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName ddddd.com
RedirectMatch permanent ^/(.*) http://www.ddddd.com/$1
</VirtualHost>
hosts:
127.0.0.1 www.ddddd.com
127.0.0.1 ddddd.com
Redirecting back to the same server, it works perfectly. Since I can’t see your actual domain, I can’t look at your DNS situation, but if you’re absolutely sure you have no other redirects on the www server, that’s where I’d look: dig those 2 domains. www might not be where you think it is, or DNS might be pointing all subdomains at the root domain.
Another possibility is that your www.mydomain.com/index.php contains something like the following.
<?php
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://mydomain.com" );
?>
Also… check WORDPRESS options … maybe is a WWW site