how to redirect 301 to new Domain without Broken links

i need htaccess code for redirect to new Domain without Broken links.


remove space in url.

my Rules:

'urlManager' => [

            /*'suffix' => '.htm',*/

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'rules' => [

                // your url config rules

                'htt p://ww<controller>/play/<id:\d+>' => '<controller>/play',

                '<controller>/<id:\d+>' => '<controller>/view',

                '<controller:(mp3|album|video|artist|news|podcast|playlist)>/page/<page:\d+>' => '<controller>/index',

                '<controller:(mp3|album|video|playlist|podcast)>/html/<id:\d+>' => '<controller>/html',

                '<controller:(tag)>/<tag>/page/<page:\d+>' => '<controller>/index',

                'tag/<tag>' => 'tag/index',



i use this code in htaccess:

RewriteCond %{HTTP_HOST} ^$ [OR]

RewriteCond %{HTTP_HOST} ^ww$

RewriteRule (.*)$ htt p://ww$1 [R=301,L]

but result is Broken links.

old link:

htt p://ww

after redirect:

htt p://ww

why index.php? mp3 is Correct.