if( preg_match( '/index.php$/' , $_SERVER['REQUEST_URI'] ) ) { header('HTTP/1.0 301 Moved Permanently'); header ( 'Location:http://www.dominio.com' ); }